Skip to content

africantearoa/Tictactoe-AI2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Tictactoe-AI2

An optimal play AI for tictactoe using python 3.5 with a recursive DFS and MinMax.

Select your team using capital X or O.

Then use the numpad to choose the move (7,8,9 for the top row, 4,5,6 for the middle row, 1,2,3 for the bottom row).

Not a particularly clean code but it works - putting it up in case it helps anyone. You might notice there's two DFS functions - the 'moderate' version has a bug in it causing it to not function optimally. I've figured out what the issue is with it and corrected it, but kept that version as it ends up being a moderately-difficult opponent (e.g. could use RNG for easy, the moderate AI for medium difficulty, and the final version for hard difficulty). If you happen to be reading this and are interested in this sort of algorithm it could be an interesting puzzle to figure out where the problem with the moderate AI lies. When I figured it out I thought it was an interesting issue that I'd written. If you have any comments feel free to add them.

I think as my next challenge I might try write a poor chess engine using the principles in this AI.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages