Elite Universe
Generate planets and galaxies following the Acornsoft Elite planet generation algorithm.
Usage
require 'elite_universe/planet'
planet = EliteUniverse::Planet.new(44344, 5276, 5405)
planet.name # = Laverequire 'elite_universe/galaxy'
galaxy = EliteUniverse::Galaxy.new(23114, 584, 46931)
galaxy[129].name # = ZaonceEliteUniverse::Galaxy is an Enumerable class and so, for example, a full list
of planet names in the galaxy can be generated with:
galaxy.map(&:name)Why
Some years ago I had a need to generate names for devices on a network for which I only had was their MAC addresses. As it happens, a MAC address is made of up 6 octets, which is equivalent to three 2-byte integers.
The number of unique planet names generated by the Elite algorithm is a long way short of the 281,474,976,710,656 possible MAC addresses. I would guess that there are a few thousand unique names, which was more than enough for my purposes and I never encountered a duplicate.
References
Mark Moxon has created a detailed overview of Elite on his software archaeology site at Elite on the 6502. Specifically, details of the galaxy generation can be found here. This would have been immensely useful several years ago when I was trying to hunt down scraps of this information from around the internet!
License
The Elite Universe gem is available to everyone under the terms of the MIT open source license. Take a look at the LICENSE file in the code.
Copyright
The Elite planet generation algorithm is copyright (c) 1984 of David Braben and Ian Bell.
This ruby implementation is copyright (c) 2015 Joe Haig