Class: RailsGame

Inherits:
Game
  • Object
show all
Defined in:
lib/rails_game.rb

Instance Attribute Summary

Attributes inherited from Game

#game_state, #players

Instance Method Summary collapse

Methods inherited from Game

#active_player_class, #check_win, #initialize, #switch_active_player

Constructor Details

This class inherits a constructor from Game

Instance Method Details

#choose_player_one(type) ⇒ Object



2
3
4
# File 'lib/rails_game.rb', line 2

def choose_player_one(type)
  choose_player(type, 'x')
end

#choose_player_two(type) ⇒ Object



6
7
8
# File 'lib/rails_game.rb', line 6

def choose_player_two(type)
  choose_player(type, 'o')
end


19
20
21
# File 'lib/rails_game.rb', line 19

def print_board
  @game_state.board.print
end

#startObject



10
11
12
# File 'lib/rails_game.rb', line 10

def start
  @game_state = GameState.new(@players[:one])
end

#update(move) ⇒ Object



14
15
16
17
# File 'lib/rails_game.rb', line 14

def update(move)
#    switch_active_player if @game_state.update(move)
  switch_active_player if @game_state.perform_move(move)
end