# Thread: 5 in a row Tic Tac Toe

1. ## 5 in a row Tic Tac Toe

Hi

I have to do 5 in a row Tic Tac Toe
for different board sizes like 5*5, 10*10, 15*15, for 3 different levels(easy,
medium, hard) Can anyone tell me how to start of with?
As i am new to AI, how to differentiate btn levels in AI n the algorithm to be used?

2. ## Re: 5 in a row Tic Tac Toe

basically on a phone, the main issue with AI will be computation speed, and for a 15*15 you'll probably have to reduce the AI
the main idea is to check the possibilities of play for the AI, give a mark to each one according to how good is the position for the AI player, and choose the best (and may be introduce some random to make it easier for the human player)
so the problematic is to find the good 'heuristic' or method of evaluation
the probleme in term of time is that if, for example, you evaluate the position at 3 in advance (do you may find a solution which is not immediately good, but leads to a better position), you need to compute 15*15*(15*15 - 1)*(15*15 - 2) at the first one, which is ~ 10^7 evaluations ...

concerning the graphics, see GameCanvas and Sprite

3. ## Re: 5 in a row Tic Tac Toe

About the algorithm, you should check the "alpha beta" algorithm (-> google). It's the simplest algorithm for this kind of games. And I agree njzk2, it will be slow on most of j2me phones ^^;

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•