-
Notifications
You must be signed in to change notification settings - Fork 80
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: abecerrilsalas <[email protected]>
…value of the square is empty it changes it to 'X', otherwise to '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.
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 |
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.
6. Follow the directions in the "Getting Started" section.w | |
6. Follow the directions in the "Getting Started" section. |
// Wave 2 | ||
const changeTheSquare = (id) => { |
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.
👍 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 = () => { |
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 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') { |
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 kind of change should be made throughout the function.
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') { |
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.
Watch the ==
use ===
instead
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) { |
This project is still in progress.