Coding an AI is language independent. What you are asking for is either the algorithm itself which could be implemented in any language, or help in solving a language-specific problem in implementing said algorithm.
If you are looking for the algorithm itself, Google is your friend and StackOverflow has all of the programming related answers you will ever need.
Comment has been collapsed.
+1 for explaining it faaar better than I was about to :c
Comment has been collapsed.
I have write down an algorithm for a nice tic-tac-toe AI for you. Give it a look.
for each of the 9 spaces{
if not occupied by mark
if placing a mark there would give you victory (check the other two spaces in the horizontal, vertical and diagonal rows)
place mark for winning
}
if not mark placed this turn{
if center space empty
place center mark
}
if not mark placed this turn{
for each of the nine spaces
if space is occupied by your mark
place mark next to it, first on corners
}
Comment has been collapsed.
Your problem can be solved by using minimax algorithm. It will search for the best branch on the game tree. Just Google 'minimax algorithm' or take a look at this for your tic-tac-toe problem.
Btw, I believe you should post this question in javabranch or stackoverflow for the best results
Comment has been collapsed.
14 Comments - Last post 5 minutes ago by yush88
22 Comments - Last post 10 minutes ago by Gamy7
3 Comments - Last post 28 minutes ago by Carenard
1,104 Comments - Last post 1 hour ago by RobbyRatpoison
43 Comments - Last post 1 hour ago by Chris76de
241 Comments - Last post 2 hours ago by TheTimmaeh
2,393 Comments - Last post 3 hours ago by FranckCastle
29,521 Comments - Last post 36 seconds ago by ELGADO26
57 Comments - Last post 1 minute ago by Mhol1071
2,803 Comments - Last post 3 minutes ago by Ellendyl
25 Comments - Last post 5 minutes ago by gus09
4 Comments - Last post 11 minutes ago by JMM72
3,700 Comments - Last post 16 minutes ago by Mhol1071
181 Comments - Last post 21 minutes ago by Kingsajz
Hey. Recently I have started learning JAVA language. Now I'm trying to make a simple Tic Tac Toe game, but I have a small problem. I'm trying to make an AI, but it just doesn't work like it's supposed to. If there are any JAVA programmers, please write me via Steam, maybe you'd be able to help me. Or if you don't want to write me via Steam, maybe you'd be able to write just a simple concept of how AI should work?
Thanks.
Comment has been collapsed.