elite_universe 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +22 -0
- data/README.md +34 -0
- data/lib/elite_universe/galaxy.rb +17 -0
- data/lib/elite_universe/planet.rb +34 -0
- data/lib/elite_universe/version.rb +3 -0
- metadata +63 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f8a6b9ecff529f8d6a857356d85ab8119ecc2688
|
4
|
+
data.tar.gz: bb484de19f10f3d2059c15955d77acbe9a63cca8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5c80012ea45574adf0c52662148cd4dfd68973a26a8d996639a263b7b0ef5d7f00f48afe1d98dad73607a150fd86a88495aafa564820aac3b5e30f7910445178
|
7
|
+
data.tar.gz: 806b8e6200aa5961d52776ba20bbf0a55e4c9c2315cc9122306379f52872907ff18e5a9ae229d343f54dc10ffc6299e54bd342d3cfec6c382244d4edb2063219
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Joseph Haig
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# Elite Universe
|
2
|
+
|
3
|
+
Generate planets and galaxies following the Acornsoft Elite planet generation
|
4
|
+
algorithm.
|
5
|
+
|
6
|
+
## Usage
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
require 'elite_universe/planet'
|
10
|
+
|
11
|
+
planet = EliteUniverse::Planet.new(44344, 5276, 5405)
|
12
|
+
planet.name # = Lave
|
13
|
+
```
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
require 'elite_universe/galaxy'
|
17
|
+
|
18
|
+
galaxy1 = EliteUniverse::Galaxy.new(23114, 584, 46931)
|
19
|
+
galaxy1.planets # = array of 'EliteUniverse::Planet's
|
20
|
+
galaxy1.planets[129].name # = Zaonce
|
21
|
+
```
|
22
|
+
|
23
|
+
## License
|
24
|
+
|
25
|
+
The Elite Universe gem is available to everyone under the terms of the MIT
|
26
|
+
open source license.
|
27
|
+
Take a look at the LICENSE file in the code.
|
28
|
+
|
29
|
+
## Copyright
|
30
|
+
|
31
|
+
The Elite planet generation algorithm is copyright (c) 1984 of David Braben and
|
32
|
+
Ian Bell.
|
33
|
+
|
34
|
+
This ruby implementation is copyright (c) 2015 BBC
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module EliteUniverse
|
2
|
+
class Planet
|
3
|
+
@@chars = '..lexegezacebisousesarmaindirea.eratenberalavetiedorquanteisrion'.scan(/../)
|
4
|
+
|
5
|
+
def initialize a, b, c
|
6
|
+
@w = [ a, b, c ]
|
7
|
+
end
|
8
|
+
|
9
|
+
def name
|
10
|
+
name = ''
|
11
|
+
v = @w
|
12
|
+
l = v[0] & 64
|
13
|
+
4.times do |i|
|
14
|
+
if i < 3 or l > 0
|
15
|
+
n = ( v[2] >> 8 ) & 31
|
16
|
+
name += @@chars[n]
|
17
|
+
end
|
18
|
+
v = twist v
|
19
|
+
end
|
20
|
+
name.gsub('.', '').capitalize
|
21
|
+
end
|
22
|
+
|
23
|
+
def next
|
24
|
+
EliteUniverse::Planet.new *(twist twist twist twist @w)
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
def twist arr
|
29
|
+
t = arr.clone
|
30
|
+
(t << ( ( arr[0] + arr[1] + arr[2] ) % 65536 ) ).shift
|
31
|
+
t
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: elite_universe
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Joe Haig
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3'
|
27
|
+
description: Implementation of the Acornsoft Elite planet generator algorithm.
|
28
|
+
email:
|
29
|
+
- joe.haig@bbc.co.uk
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- LICENSE
|
35
|
+
- README.md
|
36
|
+
- lib/elite_universe/galaxy.rb
|
37
|
+
- lib/elite_universe/planet.rb
|
38
|
+
- lib/elite_universe/version.rb
|
39
|
+
homepage: https://github.com/jrmhaig/elite_universe
|
40
|
+
licenses:
|
41
|
+
- MIT
|
42
|
+
metadata: {}
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
requirements: []
|
58
|
+
rubyforge_project:
|
59
|
+
rubygems_version: 2.4.8
|
60
|
+
signing_key:
|
61
|
+
specification_version: 4
|
62
|
+
summary: Elite Universe
|
63
|
+
test_files: []
|