Skip to content

state-of-tic-tac-toe: sync tests and fix example.jl win/turn parity bug#1125

Merged
colinleach merged 2 commits into
exercism:mainfrom
Konovor:sync/state-of-tic-tac-toe-tests
Jul 18, 2026
Merged

state-of-tic-tac-toe: sync tests and fix example.jl win/turn parity bug#1125
colinleach merged 2 commits into
exercism:mainfrom
Konovor:sync/state-of-tic-tac-toe-tests

Conversation

@Konovor

@Konovor Konovor commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

state-of-tic-tac-toe: Sync tests for playing after a win (exercism/problem-specifications#2667)

Sync tests.toml and runtests.jl with the two new canonical test cases that verify an error is thrown when a player makes a move after the game has already been won:

  • O kept playing after X wins
  • X kept playing after O wins

Fix example.jl: enforce win/turn-count parity

The reference solution failed both new test cases — it validated turn order and rejected simultaneous double wins, but never checked that a win matched the expected move count, so a board where the wrong player had an extra move after a win was incorrectly accepted. Added the missing parity check (X winning requires sum(M) == 1, O winning requires sum(M) == 0). The three alternative implementations kept as comments shared the same gap and were fixed too.

Konovor added 2 commits July 18, 2026 14:24
Applies the same fix to the active implementation and to the three
alternative implementations left as comments, all of which had the
same gap: win detection was validated independently of turn-count
parity, so a board where the wrong player had an extra move after
a win was incorrectly accepted.
@github-actions

Copy link
Copy Markdown
Contributor

This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested.

If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos.

[no important files changed]

For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping @exercism/maintainers-admin in a comment. Thank you!

@colinleach

Copy link
Copy Markdown
Contributor

There are only 21 completions on this relatively recent exercise, so I'll let them re-test.

@colinleach
colinleach merged commit 1d94cd4 into exercism:main Jul 18, 2026
7 checks passed
@colinleach

Copy link
Copy Markdown
Contributor

Thank you for fixing this!

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