-
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-Marjan, Megan, Roslyn #56
base: main
Are you sure you want to change the base?
Conversation
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.
Great work on this project Marjan, Megan and Roslyn! This project is green.
// 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 | ||
const updateSquares = (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.
There is a small logical bug here. There is no check here to see if there is a winner, so it is possible to continue to play. This can result in unexpected behavior. For example, if the board looks like this:
| | | |
| |o|o|
|x|x|x|
the game will display 'Winner is x'. However, 'o' can still move, so if 'o' clicks in the middle left square:
| | | |
|o|o|o|
|x|x|x|
the game will display "Winner is ". This continues until the entire board is filled, at which point the game will display "Winner is Tie".
for (let combo of winning){ | ||
if (isSuperset(xSet,combo)){ | ||
myX.push(combo); | ||
} | ||
} |
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.
Interesting approach!
const isSuperset = (set, subset) => { | ||
for (let elem of subset) { | ||
if (!set.has(elem)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}; |
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.
👍
// }else if (square.value==='o'){ | ||
// classVal='chris'; | ||
// } | ||
oneD.push(<Square key={square.id} id={square.id} value={square.value} onClickCallback={onClickCallback} />); |
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!
background-image: url("https://ca.slack-edge.com/T024N8K3W8N-U029WFRD8HW-807f2572ed86-512"); | ||
Background-size: 200px 200px; | ||
} | ||
|
||
.chris { | ||
background-image: url("https://ca.slack-edge.com/T024N8K3W8N-U0283SDM62H-f8f25fdaa3da-512"); | ||
Background-size: 200px 200px; | ||
} |
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.
😂
No description provided.