berlin-ai 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/lib/ai/map.rb +2 -2
  2. data/lib/version.rb +1 -1
  3. data/test/test_ai.rb +7 -6
  4. metadata +3 -3
data/lib/ai/map.rb CHANGED
@@ -40,9 +40,9 @@ module Berlin
40
40
 
41
41
  # We can now loop on our owned nodes in order to find our controlled nodes.
42
42
  def controlled_nodes
43
- owned_nodes.select do |id, node|
43
+ owned_nodes.select do |node|
44
44
  node.occupied?
45
- end.values
45
+ end
46
46
  end
47
47
 
48
48
  # Is the map directed?
data/lib/version.rb CHANGED
@@ -2,7 +2,7 @@ module Berlin
2
2
  module AI
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- BUILD = 2
5
+ BUILD = 4
6
6
 
7
7
  VERSION = "#{MAJOR}.#{MINOR}.#{BUILD}"
8
8
  end
data/test/test_ai.rb CHANGED
@@ -7,12 +7,13 @@ module Berlin
7
7
  module AI
8
8
  class Game
9
9
  def turn_moves
10
- @map.controlled_nodes do |node|
11
- {
12
- :from => node.id,
13
- :to => node.adjacent_nodes.sample.id,
14
- :number_of_soldiers => rand(node.number_of_soldiers + 1)
15
- }
10
+ @map.controlled_nodes.map do |node|
11
+ {
12
+ :from => node.id,
13
+ :to => node.adjacent_nodes.sample.id,
14
+ :number_of_soldiers => rand(node.number_of_soldiers + 1)
15
+ }
16
+ end
16
17
  end
17
18
  end
18
19
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berlin-ai
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Christian Blais