berlin-ai 0.0.10 → 0.0.11
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 +7 -3
- data/lib/version.rb +1 -1
- metadata +3 -3
data/lib/ai/map.rb
CHANGED
@@ -4,7 +4,6 @@ module Berlin
|
|
4
4
|
# nodes, points, soldiers, etc. Game will then be able to pick any information
|
5
5
|
# it wants from map to decide what are the best moves to do.
|
6
6
|
class Map
|
7
|
-
attr_accessor :nodes
|
8
7
|
attr_reader :player_id
|
9
8
|
|
10
9
|
def initialize map, infos
|
@@ -36,12 +35,17 @@ module Berlin
|
|
36
35
|
@nodes[path['to']].link_to @nodes[path['from']] unless directed?
|
37
36
|
end
|
38
37
|
end
|
38
|
+
|
39
|
+
# Returns an array of all nodes of the map
|
40
|
+
def nodes
|
41
|
+
@nodes.values
|
42
|
+
end
|
39
43
|
|
40
44
|
# Returns an array of all owned nodes
|
41
45
|
def owned_nodes
|
42
|
-
|
46
|
+
nodes.select do |node|
|
43
47
|
node.owned_by? player_id
|
44
|
-
end
|
48
|
+
end
|
45
49
|
end
|
46
50
|
|
47
51
|
# We can now loop on our owned nodes in order to find our controlled nodes.
|
data/lib/version.rb
CHANGED
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: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 11
|
10
|
+
version: 0.0.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Christian Blais
|