Class: Game
- Inherits:
-
Object
- Object
- Game
- Includes:
- Color, Evaluator, InputHandler, Presenter
- Defined in:
- lib/capim_tictactoe/game.rb
Constant Summary
Constants included from Presenter
Presenter::GREEN_GRASS, Presenter::SILLY_LINE
Instance Method Summary collapse
-
#initialize ⇒ Game
constructor
A new instance of Game.
- #start_game ⇒ Object
Methods included from InputHandler
#fetch_human_spot, #parse_args
Methods included from Presenter
Methods included from Evaluator
#eval_board, #get_best_move, #winning_move?
Methods included from Color
#line, #o_marker, #pipe, #x_marker
Constructor Details
Instance Method Details
#start_game ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/capim_tictactoe/game.rb', line 23 def start_game present_game until @board.game_over? || @board.tie? fetch_human_spot(@board, @human) eval_board(@board, @human, @computer, @options[:game_mode]) unless @board.game_over? || @board.tie? @board.grid.display end puts @board.tie? ? "I'ts a tie!" : 'Game over' end |