2

I'm sorry if this sounds very simplistic, but I've been researching for a couple of days now on how to implement AI into my Tic Tac Toe game. I have a two player game already made that I am very happy about but I have no idea how to put the AI into it. Everything I have found online has been too complicated for me to wrap my head around at my current stage of programming so I was wondering if someone could give me a dumbed down version of this? I have no idea about how to even start this so any help would be much appreciated!

Rowan
  • 57
  • 1
  • 6
  • very much depends on how your objects are added, I assume this is a 3x3 array? then its just a case of checking where there is a place for a winnning line and choosing the best choice for a square – Sayse Aug 13 '13 at 14:35
  • 1
    This is a pretty good explanation, as well as an implementation of the minimax being used in a tic tac toe game. http://ethangunderson.com/blog/minimax-algorithm-in-c/ – Tricky12 Aug 13 '13 at 14:38

1 Answers1

2

Take a look at this article

http://www.ntu.edu.sg/home/ehchua/programming/java/JavaGame_TicTacToe_AI.html

Since the sintax of the article is in Java but is very close to C#, converting this to C# will allow you to understand how it works

Mauricio Gracia Gutierrez
  • 10,288
  • 6
  • 68
  • 99