Monday, May 5, 2014

Tic Tac Toe Functions

I made a checkForWinner function that surprisingly works! I was stuck for awhile on one of the diagonal wins but the problem was that I had "(board[i+2] === board[i+4] && (board[i] === 'x' || board[i] === 'o'))" when the single i's should have been "i+2". Otherwise it kept saying there was a winner whenever a single x or o was placed on the top row.

No comments:

Post a Comment