-
Notifications
You must be signed in to change notification settings - Fork 0
Class5 tictactoe #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: gh-pages
Are you sure you want to change the base?
Conversation
reneemeyer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your logic is sound, we just need to get the syntax straightened out. Remember to test your code every line that you write, Javascript is meant to be run.
03week/ticTacToe.js
Outdated
| function horizontalWin() { | ||
| // Your code here | ||
| //horizontalWin(), checks if there are three X's or O's in [0][0], [0][1], [0][2], etc, indexOf method | ||
| if (printBoard.indexOf(printBoard) === ((([0][0]) && [0][1] && [0][2]) || ([1][0] && [1][1] && [1][2]) || ([2][0] && [2][1] && [2][2])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you checking for the index of printBoard in printBoard? This would be -1 unless there was an instance of printBoard inside of printBoard...
03week/ticTacToe.js
Outdated
| function verticalWin() { | ||
| // Your code here | ||
| //verticalWin(), checks if there are th ree X's or O'ss in [0][0], [1][0], [2][0]; [0][1], [1][1], [2][1]; [0][2], [1][2], [2][2]; indexOf method | ||
| if (printBoard.indexOf(printBoard) === ((([0][0]) && [1][0] && [2][0]) || ([0][1] && [1][1] && [2][1]) || ([0][2] && [1][2] && [2][2])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you checking for the index of printBoard in printBoard? This would be -1 unless there was an instance of printBoard inside of printBoard...
03week/ticTacToe.js
Outdated
| function diagonalWin() { | ||
| // Your code here | ||
| //diagonalWin(), checks if there are three X's or O's in [0][0], [1][1], [2][2]; [0][2], [1][1], [2][0]; indexOf method | ||
| if (printBoard.indexOf(printBoard) === ((([0][0]) && [1][1] && [2][2]) || ([0][2] && [1][1] && [2][0])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you checking for the index of printBoard in printBoard? This would be -1 unless there was an instance of printBoard inside of printBoard...
03week/ticTacToe.js
Outdated
| //ticTacToe(), begin the game with player X | ||
| print(row, column) | ||
| //playerXTurn(), set playerTurn to 'X' - place an X in the column/row that player X chooses, splice method on var board | ||
| checkForWin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This throws and error, your calling a checkForWin variable here not a function.
03week/ticTacToe.js
Outdated
| print(row, column) | ||
| //playerXTurn(), set playerTurn to 'X' - place an X in the column/row that player X chooses, splice method on var board | ||
| checkForWin | ||
| let playerTurn = 'O'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would throw and error, you already declared playerTurn. If you want to re-assign, it would be playerTurn=''O"
03week/ticTacToe.js
Outdated
| //playerOTurn(), change playerTurn to 'O' - switch to player O, place an O in the column/row that player O chooses, splice method on var board | ||
| //switch back to player X, run the same code again | ||
| checkForWin | ||
| let playerTurn = 'X'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would throw and error, you already declared playerTurn. If you want to re-assign, it would be playerTurn=''O"
03week/ticTacToe.js
Outdated
| let playerTurn = 'O'; | ||
| //playerOTurn(), change playerTurn to 'O' - switch to player O, place an O in the column/row that player O chooses, splice method on var board | ||
| //switch back to player X, run the same code again | ||
| checkForWin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This throws and error, your calling a checkForWin variable here not a function.
03week/ticTacToe.js
Outdated
| checkForWin | ||
| let playerTurn = 'X'; | ||
| //Between every turn, run checkForWin | ||
| checkForWin; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This throws and error, your calling a checkForWin variable here not a function.
…tributes in a function
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