Skip to content

Instantly share code, notes, and snippets.

@dtrailin
Created July 31, 2012 07:26
Show Gist options
  • Select an option

  • Save dtrailin/3214498 to your computer and use it in GitHub Desktop.

Select an option

Save dtrailin/3214498 to your computer and use it in GitHub Desktop.
Logic for Tic Tac Toe AI
:
1. Check if there is a tile that you can win in 1 move
if there is no such tile:
2. Check if there is a tile that your opponent can win in 1 move
if there is no such tile:
3. Check if there is a tile that can make two tiles apply to the rule #1
if there is no such tile:
4. Check if there is a tile that your opponent can make two tiles apply to the rule #2
if there is no such tile:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment