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

Tic Tac Toe: Fixes win check on the last turn #37

Merged
merged 1 commit into from
Mar 30, 2022
Merged

Tic Tac Toe: Fixes win check on the last turn #37

merged 1 commit into from
Mar 30, 2022

Conversation

aversey
Copy link
Contributor

@aversey aversey commented Mar 28, 2022

The fix adds a winning conditions check for the last turn.

My first attempt to test/play the game happened to end in a win on the last turn, however the app showed "It is a tie!".

In this commit, I removed the upper bound check (as the turn can not be bigger than 8, and we need to check a win in case it is 8), and moved the code to show "It is a tie!" to be displayed only if there is no winner and the turn is 8. After turn 8, b.finished will be true (if there is no winner, it will become true because it is turn 8; otherwise we have a winner, and b.finished will become true too).

The fix adds a winning conditions check for the last turn.

My first attempt to test/play the game happened to end in a win on the last turn, however the app showed "It is a tie!".

In this commit, I removed the upper bound check (as the turn can not be bigger than 8, and we need to check a win in case it is 8), and moved the code to show "It is a tie!" to be displayed only if there is no winner and the turn is 8. After turn 8, b.finished will be true (if there is no winner, it will become true because it is turn 8; otherwise we have a winner, and b.finished will become true too).
Copy link
Member

@andydotxyz andydotxyz left a comment

Choose a reason for hiding this comment

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

Good catch thanks :)

@andydotxyz andydotxyz merged commit 06b751e into fyne-io:develop Mar 30, 2022
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.

2 participants