class TicTacToe::Lines

Public Instance Methods

can_lose(player) click to toggle source
# File lib/tic_tac_toe_mchliakh/board/lines.rb, line 7
def can_lose(player)
  select {|l| l.can_lose?(player) }
end
can_win(player) click to toggle source
# File lib/tic_tac_toe_mchliakh/board/lines.rb, line 3
def can_win(player)
  select {|l| l.can_win?(player) }
end
could_lose(player) click to toggle source
# File lib/tic_tac_toe_mchliakh/board/lines.rb, line 15
def could_lose(player)
  select {|l| l.could_lose?(player) }
end
could_win(player) click to toggle source
# File lib/tic_tac_toe_mchliakh/board/lines.rb, line 11
def could_win(player)
  select {|l| l.could_win?(player) }
end
squares_that_can_be_forked(player) click to toggle source
# File lib/tic_tac_toe_mchliakh/board/lines.rb, line 25
def squares_that_can_be_forked(player)
  Squares.new(could_lose(player).combination(2).map do |ll|
    (ll.first & ll.last).first
  end.compact)
end
squares_that_can_fork(player) click to toggle source
# File lib/tic_tac_toe_mchliakh/board/lines.rb, line 19
def squares_that_can_fork(player)
  Squares.new(could_win(player).combination(2).map do |ll|
    (ll.first & ll.last).first
  end.compact)
end