Class: XO::Init

Inherits:
GameState
  • Object
show all
Defined in:
lib/xo/engine/init.rb

Instance Method Summary collapse

Instance Method Details

#start(turn) ⇒ Object

Starts a new game.

The engine is transitioned into the Playing state and the event

{ name: :game_started }

is triggered.

Parameters:

Raises:



18
19
20
21
22
# File 'lib/xo/engine/init.rb', line 18

def start(turn)
  game_context.check_turn(turn)
  game_context.set_turn_and_clear_grid(turn)
  engine.transition_to_state_and_send_event(Playing, :game_started)
end