Minimax data structure
A couple of weeks ago, I began to teach myself C. (I am new to programming.)
I set myself the challenge of coding my own Tic-Tac-Toe game. I thought that creating the game would be a good exercise -- which it has been. The trouble is, I'm stuck. I intended to implement a simple AI that would follow a set of simple rules but I discovered that this made the computer far too stupid. ...and that's when I discovered the Minimax concept.
I'm not terribly great with technical books. I have to be in the right mood. I started out with the book 'Learn C on the Mac' (which gave me an excellent introduction) and have recently picked up a copy of K&R but I find K&R far too overwhelming. When I get overwhelmed, I get stressed. When I get stressed I lose concentration.
What I'm trying to say is: I've seen a couple of examples of Minimax search trees (apparently, it's a simple concept) and other people's Tic-Tac-Toe source but I cannot help but feel overwhelmed by these examples. The code looks familiar, and it looks like I should understand it. But I don't.
I understand structs -- at least, in their simplest forms. I understand pointers. I have used arrays. The bottom line is: help. I need someone to tell me what my next steps should be.
I want to implement a Minimax AI in my game. Presently, I don't know how to do this. I've seen examples; I don't understand them. What do I need to know to understand them? And... what do I need to do to know it?
I'm not sure studying the mini-max algorithm is the best choice for a beginner. This is one tutorial on it, but perhaps you could code up a TTT game without mm for now, and then add the mm to it, after you have a bit more experience?
Minimax Explained - AI Depot