class Rules
Constants
- WINNING_COMBOS
Public Class Methods
new(board)
click to toggle source
# File lib/ttt_malisa/rules.rb, line 5 def initialize(board) @board = board end
Public Instance Methods
draw?()
click to toggle source
# File lib/ttt_malisa/rules.rb, line 32 def draw? !winning_combination? && @board.full? end
game_over?()
click to toggle source
# File lib/ttt_malisa/rules.rb, line 20 def game_over? winning_combination? || draw? end
winning_combination?()
click to toggle source
# File lib/ttt_malisa/rules.rb, line 24 def winning_combination? WINNING_COMBOS.any? do |x, y, z| @board.position_taken?(x) && @board.squares[x] == @board.squares[y] && @board.squares[x] == @board.squares[z] end end