thats a lotta code...
I d'loaded that TTT game posted previously and was overwhelmed to find 1900+lines of code. :eek: Holy frijoles!!
Is that a 'typically' sized TTT game?
In my imagination I was figuring about 4-500 lines would do it. However, I'm a noob, only about halfway thru the SAMS 21 day book.
I goota say, that file has me a little scared, lol :(
Yeah, 1900+ lines is really long for a TTT game.
Here's a link if you want to get a brief intro on these search trees:
You may want to do a search on depth first search. This will help you get started.
Here's a couple of hints:
Think about the symmetry of the game. Say for example, an opponent's first move is in the middle. You have 2 possibilities: a corner move or a side move. That way you won't have to search for all the possibilities since they're symmetric.
And if a position you search shows that you win 100% of the time, you can stop searching for any other possibilities.
Mmm, here's an AI-free version in 150 lines
My MFC windowed version is only about 500 lines, 1900 lines is huge for tictactoe
I made TTT with Windows GDI, with very very limited *ai* (selects a random open spot :D)... it took 287 lines of code (minus a resource file). I made it in MSVC++, so maybe there's some behind-the-scenes stuff goin' on... anyways, you can take a look if you want.