Skip to content

Fix #21: README: say the computer plays an edge when every free corner loses to a fork - #22

Open
tanujb03 wants to merge 1 commit into
techcsispit:mainfrom
tanujb03:docs/21-readme-ttt-corner-rule
Open

tanujb03 wants to merge 1 commit into
techcsispit:mainfrom
tanujb03:docs/21-readme-ttt-corner-rule

Conversation

@tanujb03

Copy link
Copy Markdown

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.

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.

README: the tic-tac-toe computer does not always take a corner after the centre

1 participant