Class: TicTacToe::Rules
- Inherits:
-
Object
- Object
- TicTacToe::Rules
- Defined in:
- lib/tic_tac_toe/rules.rb
Instance Method Summary collapse
- #game_over?(board, players) ⇒ Boolean
-
#initialize(goal) ⇒ Rules
constructor
A new instance of Rules.
Constructor Details
#initialize(goal) ⇒ Rules
Returns a new instance of Rules.
3 4 5 |
# File 'lib/tic_tac_toe/rules.rb', line 3 def initialize(goal) @goal = goal end |
Instance Method Details
#game_over?(board, players) ⇒ Boolean
7 8 9 |
# File 'lib/tic_tac_toe/rules.rb', line 7 def game_over?(board, players) players.any? { |player| player_won?(player, board) } or board_full?(board) end |