Skip to content

Instantly share code, notes, and snippets.

@tarynsauer
Created December 5, 2013 04:27
Show Gist options
  • Save tarynsauer/7800075 to your computer and use it in GitHub Desktop.
Save tarynsauer/7800075 to your computer and use it in GitHub Desktop.
### DIP -- gets winner regardless of board size or specified winning lines
def winner?(board)
board_markers = board.all_cells.select { |k,v| v == self.marker }.keys
board.winning_lines.each do |line|
return true if (line & board_markers).length == board.num_of_rows
end
false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment