Skip to content

Nicole W. : Maple #79

Open
N-Washington wants to merge 8 commits intoAda-C16:mainfrom
N-Washington:main
Open

Nicole W. : Maple #79
N-Washington wants to merge 8 commits intoAda-C16:mainfrom
N-Washington:main

Conversation

@N-Washington
Copy link
Copy Markdown

No description provided.

Comment thread src/App.js
// 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);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be PLAYER_1

Comment thread src/App.js
setSquares(newState);
let newPlayer;
if (currentPlayer == PLAYER_1) {
newPlayer = PlAYER_2;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be PLAYER_2

Comment thread src/App.js
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);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you push your updates we went over this should be fixed. We remove this code because you were just testing some things out.

Comment thread src/App.js
return null;
};

const resetGame = () => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the resetGame function you want to "reset" the values back to their default values.

Comment thread src/App.js
@@ -59,7 +119,7 @@ const App = () => {
<button>Reset Game</button>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add an onClick that will trigger the resetGame function

@tgoslee
Copy link
Copy Markdown

tgoslee commented Jan 13, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants