Pine - Alma and Ainur#62
Open
adjayanbaeva wants to merge 8 commits into
Open
Conversation
Co-authored-by: abecerrilsalas <abecerrilsalas@users.noreply.github.com>
…value of the square is empty it changes it to 'X', otherwise to 'o'
CheezItMan
reviewed
Dec 23, 2021
| 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.
Suggested change
| 6. Follow the directions in the "Getting Started" section.w | |
| 6. Follow the directions in the "Getting Started" section. |
| const [currentSquare, setCurrentSquare] = useState(false); | ||
|
|
||
| // Wave 2 | ||
| const changeTheSquare = (id) => { |
There was a problem hiding this comment.
👍 Nice work, very straightforward solution.
| // When it is clicked on. | ||
| // Then pass it into the squares as a callback | ||
|
|
||
| const checkForWinner = () => { |
There was a problem hiding this comment.
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.
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') { |
There was a problem hiding this comment.
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) { |
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.
This project is still in progress.