Last active
August 29, 2015 14:28
-
-
Save adellhk/1bafc78b6ea072fc1ba0 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
def vert(board) | |
board[0].each_with_index do |cell, column_num| | |
puts "Cell: #{cell}" | |
if cell == "x" | |
column = [] | |
4.times do |row_num| | |
column << board[row_num + 1][column_num] | |
end | |
puts "#Column: #{column}" | |
return true if column.count('x') == 4 | |
end | |
end | |
return false | |
end | |
def vert(board) | |
board.transpose.include?( %w(x x x x x) ) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment