Post Reply 
For your consideration... TIC-TAC-MAX... a tic-tac-toe game with miniMax AI.
11-01-2016, 01:15 PM
Post: #1
For your consideration... TIC-TAC-MAX... a tic-tac-toe game with miniMax AI.
I wanted to learn about the miniMax algorithm, so I wrote this tic-tac-toe game and implemented miniMax so you could play a game against your Prime. It has a full touch screen interface:

[Image: TIC_TAC_MAX.png]

Instructions are included in the zip file.

When implementing the AI, I used the miniMax algorithm in a recursive function. The way I had originally coded the application, if the computer got to move first in a new game, it had to recurse through 9! or 362,880 possible moves. While this only took a few seconds with the emulated Prime calculator on my PC, the actual calculator took about 2 1/2 minutes to do this! In order to speed things up, I implemented some logic. If it is the Prime's go first, pick the center square. After the player's turn, this now leaves 7! moves or 5,040 possibilities to search through... much faster! If it is the Prime's move second, it checks to see if the center square has been taken. If not, choose it, otherwise choose a corner square at random. After the player's third move, it now only has 6! or 720 moves to recurse through. In order to create a weaker AI for different levels I limited the depth of the miniMax search. I'm sure the algorithm could be improved by adding alpha-beta pruning... maybe some industrious coder out there is up to the challenge!

All in all this was a fun application to code. I am thinking about doing a chess engine for the Prime, although I am not sure how feasible that would be... if it would be strong enough and fast enough to have a decent ELO rating.

I would also like to thank and acknowledge Mickaƫl Nicotera whose TIC-TAC-TOE game was the inspiration for this version.

Anyways, I hope everyone enjoys. Any suggestions or comments are welcome.


Attached File(s)
.zip  TIC_TAC_MAX.zip (Size: 135.57 KB / Downloads: 22)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
For your consideration... TIC-TAC-MAX... a tic-tac-toe game with miniMax AI. - falcon56215 - 11-01-2016 01:15 PM



User(s) browsing this thread: 1 Guest(s)