Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Algorithm that will tie or beat you at tic-tac-toe:
- 1 2 3
- 4 5 6
- 7 8 9
- The algorithm always goes first. It will always choose 5.
- Choose a number to represent your turn.
- The algorithm will choose your last turn * 2. If the result is >= 9, subtract 9.
- If the algorithm chooses a place that is already taken, subtract 1 until it finds a place that isn't. If it hits 1, add 1 until it finds a free place.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement