elite_universe 0.0.2 → 0.0.3
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 +4 -4
- data/lib/elite_universe/planet.rb +45 -5
- data/lib/elite_universe/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a36098d3714f0989351399192412e66461c346b
|
4
|
+
data.tar.gz: 49403e254030ca2d188b6b28b1d4de962347f4b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d248e1f21f0c6f454c262336d02422afbe3dfe1d251e47570d58b7038a2f636cab6d62d1fcac1f17b55b91fdf9a2624969fd63adb2b29a1ee28b0527914829d
|
7
|
+
data.tar.gz: 31587a0a59e301c7b2f682e88da0cf8ff0db0fdc79f879f9f4798339315cb82dd4c430613c669c70adf0100693892271c4f2969bfa5fc5f05a606c579ab252b0
|
@@ -1,6 +1,27 @@
|
|
1
1
|
module EliteUniverse
|
2
2
|
class Planet
|
3
|
-
|
3
|
+
CHARS = '..lexegezacebisousesarmaindirea.eratenberalavetiedorquanteisrion'.scan(/../)
|
4
|
+
GOVS = [
|
5
|
+
'Anarchy',
|
6
|
+
'Feudal',
|
7
|
+
'Multi-Government',
|
8
|
+
'Dictatorship',
|
9
|
+
'Communist',
|
10
|
+
'Confederate',
|
11
|
+
'Democratic',
|
12
|
+
'Corporate',
|
13
|
+
]
|
14
|
+
|
15
|
+
ECONS = [
|
16
|
+
'Rich Industrial',
|
17
|
+
'Average Industrial',
|
18
|
+
'Poor Industrial',
|
19
|
+
'Mainly Industrial',
|
20
|
+
'Mainly Agricultural',
|
21
|
+
'Rich Agricultural',
|
22
|
+
'Average Agricultural',
|
23
|
+
'Poor Agricultural',
|
24
|
+
]
|
4
25
|
|
5
26
|
def initialize a, b, c
|
6
27
|
@w = [ a, b, c ]
|
@@ -13,22 +34,41 @@ module EliteUniverse
|
|
13
34
|
4.times do |i|
|
14
35
|
if i < 3 or l > 0
|
15
36
|
n = ( v[2] >> 8 ) & 31
|
16
|
-
name +=
|
37
|
+
name += CHARS[n]
|
17
38
|
end
|
18
39
|
v = twist v
|
19
40
|
end
|
20
41
|
name.gsub('.', '').capitalize
|
21
42
|
end
|
22
43
|
|
44
|
+
def government
|
45
|
+
GOVS[ gov_n ]
|
46
|
+
end
|
47
|
+
|
48
|
+
def economy
|
49
|
+
ECONS[ econ_n ]
|
50
|
+
end
|
51
|
+
|
52
|
+
def location
|
53
|
+
[ @w[1] >> 8, @w[0] >> 8 ]
|
54
|
+
end
|
55
|
+
|
23
56
|
def next
|
24
57
|
EliteUniverse::Planet.new *(twist twist twist twist @w)
|
25
58
|
end
|
26
59
|
|
27
60
|
private
|
28
61
|
def twist arr
|
29
|
-
|
30
|
-
|
31
|
-
|
62
|
+
[ arr[1], arr[2], arr.inject(:+) % 65536 ]
|
63
|
+
end
|
64
|
+
|
65
|
+
def gov_n
|
66
|
+
( @w[1] >> 3 ) & 7
|
67
|
+
end
|
68
|
+
|
69
|
+
def econ_n
|
70
|
+
e = ( @w[0] >> 8 ) & 7
|
71
|
+
gov_n <= 1 ? e | 2 : e
|
32
72
|
end
|
33
73
|
end
|
34
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elite_universe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Haig
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|