Repository navigation
Conversation
… free corner loses to a fork
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.
Closes #21
What I changed
One sentence in the README's tic-tac-toe section. It now keeps the existing win / block / centre / corner order and adds: "If every free corner would lose to a fork, it plays an edge instead." No code changes.
How it works
Since the minimax change (#11) the computer picks the best-scoring move and only uses centre, then corners, then edges to break ties. So the old "then a corner" is wrong in one case: with X on 1 and 9 and O in the centre, a corner for O loses to a fork, and the game plays square 2 (an edge). I checked this by running the game (menu 2, then squares 1 and 9, and the computer answers 5 then 2) and with a small brute-force check over every reachable position: the only two positions where it plays an edge while a corner is free (this one and its mirror) are the ones where every free corner loses by force. I left the win and block wording alone, since #15 is about the computer missing a win, which is a code question and does not change this sentence.