class Berlin::AI::Game

Game keeps track of current games played by the server, indexing them on their uniq id.

Attributes

current_turn[RW]
id[RW]
map[RW]
maximum_number_of_turns[RW]
moves[RW]
number_of_players[RW]
player_id[RW]
time_limit_per_turn[RW]
turns_left[RW]

Public Instance Methods

add_move(from, to, number_of_soldiers) click to toggle source
# File lib/ai/game.rb, line 10
def add_move(from, to, number_of_soldiers)     
  # remove moving soldiers from from node
  from.available_soldiers -= number_of_soldiers

  # adding incoming soldiers to next node
  to.incoming_soldiers += number_of_soldiers

  # add move
  @moves << {:from => from.to_i, :to => to.to_i, :number_of_soldiers => number_of_soldiers.to_i}
end