berlin-ai 0.0.16 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ai/game.rb +7 -2
- data/lib/version.rb +1 -1
- metadata +4 -4
data/lib/ai/game.rb
CHANGED
@@ -16,8 +16,8 @@ module Berlin
|
|
16
16
|
map = JSON.parse( map )
|
17
17
|
state = JSON.parse( state )
|
18
18
|
|
19
|
-
# Game id
|
20
|
-
game_id = infos['game_id']
|
19
|
+
# Game id, set with player_id as well so an AI can fight with himself
|
20
|
+
game_id = "#{infos['game_id']}-#{infos['player_id']}"
|
21
21
|
|
22
22
|
# Then, let's see if we can find that game. If not, register it.
|
23
23
|
if action == "ping"
|
@@ -43,8 +43,13 @@ module Berlin
|
|
43
43
|
# Extract usefull informations
|
44
44
|
@player_id = infos['player_id']
|
45
45
|
@time_limit_per_turn = infos['time_limit_per_turn']
|
46
|
+
@current_turn = infos['current_turn'].to_i
|
47
|
+
@maximum_number_of_turns = infos['maximum_number_of_turns'].to_i
|
46
48
|
@number_of_players = infos['number_of_players']
|
47
49
|
|
50
|
+
# How many turns left?
|
51
|
+
@turns_left = @maximum_number_of_turns - @current_turn
|
52
|
+
|
48
53
|
# Keep track of the player moves
|
49
54
|
@moves = []
|
50
55
|
|
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: 61
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 17
|
10
|
+
version: 0.0.17
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Christian Blais
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-06-
|
20
|
+
date: 2011-06-09 00:00:00 -04:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|