Class: FallBack

Inherits:
Action show all
Defined in:
lib/software_challenge_client/action.rb

Instance Method Summary collapse

Methods inherited from Action

#invalid

Instance Method Details

#==(other) ⇒ Object



214
215
216
# File 'lib/software_challenge_client/action.rb', line 214

def ==(other)
  other.type == type
end

#perform!(gamestate) ⇒ Object



203
204
205
206
207
208
# File 'lib/software_challenge_client/action.rb', line 203

def perform!(gamestate)
  valid, message = GameRules.is_valid_to_fall_back(gamestate)
  raise InvalidMoveException("Es kann gerade kein Rückzug gemacht werden. " + message) unless valid
  gamestate.current_player.index = gamestate.previous_field_of_type(FieldType::HEDGEHOG, gamestate.current_player.index).index
  gamestate.set_last_action(self)
end

#typeObject



210
211
212
# File 'lib/software_challenge_client/action.rb', line 210

def type
  :fall_back
end