For some reason, this is not iterating over the collection. Throwing a pry in there shows that only the first index is getting looked at. [0,1,2] I'm sure I'm just tired and it's something small, but I'm drawing a black here,
WIN_COMBINATIONS = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 3, 6],
[1, 4, 7],
[2, 5, 8],
[0, 4, 8],
[2, 4, 6]
]
def won?(board)
WIN_COMBINATIONS.each do |combo|
if board[combo[0]] != " " && board[combo[0]] == board[combo[1]] && board[combo[0]] == board[combo[2]]
return combo
else
return false
end
end
end
won?method?board = ["O", "O", " ", "X", "X", "X", " ", " ", " "]in the test is where it's getting passed in.