Module: Berlin::AI::Game::Internal

Included in:
Berlin::AI::Game
Defined in:
lib/ai/game_internal.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



45
46
47
# File 'lib/ai/game_internal.rb', line 45

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#reset!Object



58
59
60
61
# File 'lib/ai/game_internal.rb', line 58

def reset!
  @moves = []
  @map.nodes.each(&:reset!)
end

#update(current_turn, state) ⇒ Object



49
50
51
52
53
54
55
56
# File 'lib/ai/game_internal.rb', line 49

def update(current_turn, state)
  # Update turn infos
  @current_turn = current_turn.to_i
  @turns_left   = @maximum_number_of_turns - @current_turn
  
  # Update map state
  @map.update(state)
end