Open
Conversation
stu-k
suggested changes
Oct 26, 2017
stu-k
left a comment
There was a problem hiding this comment.
You're so close! Your logic is #solid for checkForWin() and ticTacToe(), you just have to go for it!
| // Your code here | ||
| // Got help from eddy, I do not completely understand yet | ||
| const checkForWin = () => { | ||
| // if (horizontalWin() || verticalWin() || diagonalWin()) { |
There was a problem hiding this comment.
You can do it! This logic is correct, keep going! Just ignore the turncount thing, and if you look at the tests below, they expect checkForWin() to return either true or false.
| // playerTurn = 'X'; | ||
| // } | ||
| // if (board[row][column] === ' ') { | ||
| // board[row].splice(column, 1, playerTurn); |
There was a problem hiding this comment.
Instead of using unnecessary methods, set that value = to playerTurn.
| it('should alternate between players', () => { | ||
| ticTacToe(0, 0); | ||
| assert.deepEqual(board, [ ['O', ' ', ' '], [' ', 'X', ' '], [' ', ' ', ' '] ]); | ||
| assert.deepEqual(board, [ ['O', '', ' '], [' ', 'X', ' '], [' ', ' ', ' '] ]); |
There was a problem hiding this comment.
Put the space back! The tests need it! (In board[0][1], I think you accidentally took it out).
| // 10 11 12 | ||
| // 20 21 22 | ||
| const horizontalWin = () => { | ||
| if ((board[0][0] === board[0][1] && board[0][1] === board[0][2]) || (board[1][0] === board[1][1] && board[1][1] === board[1][2]) || (board[2][0] === board[2][1] && |
There was a problem hiding this comment.
Yes! Yes yes! You got the short way to reference three cells. Nice work! I mean, SOLID work!
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checkpoint Rubric
This is the rubric that your instructor will use to grade your checkpoints. Please do not edit.
Checkpoint 1
Checkpoint 2
Checkpoint 3