elite_universe 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f8a6b9ecff529f8d6a857356d85ab8119ecc2688
4
- data.tar.gz: bb484de19f10f3d2059c15955d77acbe9a63cca8
3
+ metadata.gz: 3a36098d3714f0989351399192412e66461c346b
4
+ data.tar.gz: 49403e254030ca2d188b6b28b1d4de962347f4b1
5
5
  SHA512:
6
- metadata.gz: 5c80012ea45574adf0c52662148cd4dfd68973a26a8d996639a263b7b0ef5d7f00f48afe1d98dad73607a150fd86a88495aafa564820aac3b5e30f7910445178
7
- data.tar.gz: 806b8e6200aa5961d52776ba20bbf0a55e4c9c2315cc9122306379f52872907ff18e5a9ae229d343f54dc10ffc6299e54bd342d3cfec6c382244d4edb2063219
6
+ metadata.gz: 6d248e1f21f0c6f454c262336d02422afbe3dfe1d251e47570d58b7038a2f636cab6d62d1fcac1f17b55b91fdf9a2624969fd63adb2b29a1ee28b0527914829d
7
+ data.tar.gz: 31587a0a59e301c7b2f682e88da0cf8ff0db0fdc79f879f9f4798339315cb82dd4c430613c669c70adf0100693892271c4f2969bfa5fc5f05a606c579ab252b0
@@ -1,6 +1,27 @@
1
1
  module EliteUniverse
2
2
  class Planet
3
- @@chars = '..lexegezacebisousesarmaindirea.eratenberalavetiedorquanteisrion'.scan(/../)
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 += @@chars[n]
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
- t = arr.clone
30
- (t << ( ( arr[0] + arr[1] + arr[2] ) % 65536 ) ).shift
31
- t
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
@@ -1,3 +1,3 @@
1
1
  module EliteUniverse
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  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.2
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-14 00:00:00.000000000 Z
11
+ date: 2015-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec