Created
December 5, 2013 04:27
-
-
Save tarynsauer/7800075 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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