Class: XO::GameOver
- Defined in:
- lib/xo/engine/game_over.rb
Instance Method Summary collapse
-
#continue_playing ⇒ Object
Starts another new game.
-
#stop ⇒ Object
Stops and resets a game.
Instance Method Details
#continue_playing ⇒ Object
Starts another new game.
The token that won plays first, otherwise the game was squashed and so the next token plays first.
The engine is transitioned into the Playing state and the event
{ name: :game_started, type: :continue_playing }
is triggered.
28 29 30 31 |
# File 'lib/xo/engine/game_over.rb', line 28 def game_context.set_turn_and_clear_grid(game_context.turn) engine.transition_to_state_and_send_event(Playing, :game_started, type: :continue_playing) end |
#stop ⇒ Object
Stops and resets a game.
The engine is transitioned into the Init state and the event
{ name: :game_stopped }
is triggered.
14 15 16 |
# File 'lib/xo/engine/game_over.rb', line 14 def stop stop_game end |