berlin-ai 0.0.2 → 0.0.4
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.
- data/lib/ai/map.rb +2 -2
- data/lib/version.rb +1 -1
- data/test/test_ai.rb +7 -6
- 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 |
|
43
|
+
owned_nodes.select do |node|
|
44
44
|
node.occupied?
|
45
|
-
end
|
45
|
+
end
|
46
46
|
end
|
47
47
|
|
48
48
|
# Is the map directed?
|
data/lib/version.rb
CHANGED
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
|
-
|
13
|
-
|
14
|
-
|
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:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Christian Blais
|