Nicole W. : Maple #79
Open
N-Washington wants to merge 8 commits intoAda-C16:mainfrom
Open
Conversation
Digital starter
tgoslee
reviewed
Jan 13, 2022
| // This starts state off as a 2D array of JS objects with | ||
| // empty value and unique ids. | ||
| const [squares, setSquares] = useState(generateSquares()); | ||
| const [currentPlayer, setCurrentPlayer] = useState(PlAYER_1); |
tgoslee
reviewed
Jan 13, 2022
| setSquares(newState); | ||
| let newPlayer; | ||
| if (currentPlayer == PLAYER_1) { | ||
| newPlayer = PlAYER_2; |
tgoslee
reviewed
Jan 13, 2022
Comment on lines
+57
to
+66
| const row = parseInt(id / 3); | ||
| const col = id - 3 * parseInt(id / 3); | ||
|
|
||
| // Wave 2 | ||
| // You will need to create a method to change the square | ||
| // When it is clicked on. | ||
| // Then pass it into the squares as a callback | ||
|
|
||
| // will pass whoevers turn it is here | ||
|
|
||
| squares[row][col] = 'x'; | ||
|
|
||
| // change the state | ||
| setSquares(squares); |
There was a problem hiding this comment.
When you push your updates we went over this should be fixed. We remove this code because you were just testing some things out.
tgoslee
reviewed
Jan 13, 2022
| return null; | ||
| }; | ||
|
|
||
| const resetGame = () => { |
There was a problem hiding this comment.
for the resetGame function you want to "reset" the values back to their default values.
tgoslee
reviewed
Jan 13, 2022
| @@ -59,7 +119,7 @@ const App = () => { | |||
| <button>Reset Game</button> | |||
There was a problem hiding this comment.
add an onClick that will trigger the resetGame function
|
Hey Nicole! I added some comments from when we looked at your code in our 1:1 and then how to get resetGame working (even though it's optional). Push the changes we did and let me know if you have any additional questions. |
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.
No description provided.