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

two winners possible... #1

Open
streger opened this issue Oct 25, 2019 · 2 comments
Open

two winners possible... #1

streger opened this issue Oct 25, 2019 · 2 comments

Comments

@streger
Copy link

streger commented Oct 25, 2019

I know this is just a demo, but it doesn't hurt to have some logic to not allow input after "first win".
Check screens:
"First win"
image
"second win"
image

@philster
Copy link

Quick fix may be to replace

if (!squares[i]) {

with

if (!winner && !squares[i]) {

on this line https://github.com/deadcoder0904/tic-tac-toe-svelte/blob/master/src/Board.svelte#L16

@deadcoder0904
Copy link
Owner

deadcoder0904 commented Feb 13, 2020

Sorry, didn’t receive a notification for this.

@streger You’re right. Never got that edge case. Can u tell me the steps to reproduce that? I can’t seem to replicate.

Also, try maybe @philster’s solution. It might be right.

What I think a simple solution might be is you can disable the button when someone wins first :)

I won’t be changing the code now as u said it’s just a demo. It’s more about learning Svelte than getting the logic right for what it’s worth. Still appreciate u taking the time to think through the edge case 🙌

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

No branches or pull requests

3 participants