Skip to content
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

Pine - Alma and Ainur #62

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

adjayanbaeva
Copy link

This project is still in progress.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

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

You almost have this. The detect winner is almost done, just a few typos left. See my feedback here. These kind of changes throughout the checkForWinner function will make it work.

Impressive for starting on Monday.

🟡

@@ -81,7 +81,7 @@ We can run `yarn install` multiple times safely, but we only need to do this onc

The file `package.json` contains details about our project, the scripts available, and the dependencies needed. We can inspect this file when we are curious about the details of our dependencies.

6. Follow the directions in the "Getting Started" section.
6. Follow the directions in the "Getting Started" section.w

Choose a reason for hiding this comment

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

Suggested change
6. Follow the directions in the "Getting Started" section.w
6. Follow the directions in the "Getting Started" section.

// Wave 2
const changeTheSquare = (id) => {

Choose a reason for hiding this comment

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

👍 Nice work, very straightforward solution.

}
setSquares(newSquares);
};

// 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

const checkForWinner = () => {

Choose a reason for hiding this comment

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

This looks like it works to detect a winner. The only problem is that you're using 'X' instead of 'x' etc

let countX = 0;
let countO = 0;
for (let col = 0; col < 3; col += 1) {
if (squares[row][col] === 'X') {

Choose a reason for hiding this comment

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

This kind of change should be made throughout the function.

Suggested change
if (squares[row][col] === 'X') {
if (squares[row][col].value === PLAYER_1) {

}
}
//Check dioganals
if (squares[0][0] == 'X' && squares[1][1] == 'X' && squares[2][2] == 'X') {

Choose a reason for hiding this comment

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

Watch the == use === instead

Suggested change
if (squares[0][0] == 'X' && squares[1][1] == 'X' && squares[2][2] == 'X') {
if (squares[0][0].value === PLAYER_1 && squares[1][1].value === PLAYER_1 && squares[2][2].value === PLAYER_1) {

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