how to represent a tic tac toe tree in c++

Started by
7 comments, last by GBGames 19 years, 3 months ago
hi, i want to know how to represent a tic tac toe tree in c++ also tell me how to write a tic tac toe game.
Advertisement
Not tic-tac-toe AGAIN

ok then. you can search gdnet to find everywhichweay to do this.

But to answer your question...

What you have is a struct which contains:
an array of 9 elements which are all pointers of type struct_name
you have the board state (an array of 9 ints)
And an int which signifies if this is an end state

Now how to do tic-tac-toe, ther are heaps of ways, from minimax with alphabeta, to simple rules, to a learning system.

From,
Nice coder
Click here to patch the mozilla IDN exploit, or click Here then type in Network.enableidn and set its value to false. Restart the browser for the patches to work.
It has come to my attention that tic tac toe is a common introduction to programming assignment at some schools.
I noticed an increase in tic-tac-toe questions since the competition at http://www.newgameprojects.net/ that is giving away Visual Studio .NET to the winner.
... and that making a tic-tac-toe is given as a suggestion in the forum faq. I guess we'll have to cope with these question - of course, if they come from the newgameprojects compettion, then I suggest their author to put them on the corresponding NGP forum.

It is not that bad - and perhaps someone will have the good idea to write a complete article on the possible tic tac toe algorithms.

Regards,
If you're new to programming, tic-tac-toe has enough programming elements to be very helpful. Here's an implementation that I tried. But as the other's suggested, there's lots of ways to go about this. If you don't get bored with the game, trying the same thing multiple ways is a nice learning tool. Have fun.
My website
I'm using Tic-Tac-Toe to relearn a programming language that I've been away from for way too long. B-)
-------------------------GBGames' Blog: An Indie Game Developer's Somewhat Interesting ThoughtsStaff Reviewer for Game Tunnel
GBGames: Any chance that the language in question is QuickBasic?

Chris 'coldacid' Charabaruk – Programmer, game designer, writer | twitter

No, it's C++. But thanks for remembering. B-) You can still find my Qbasic site at http;//qbasic.gbgames.com in case you haven't seen my posts on qb45.com and vplanetmag.com.
-------------------------GBGames' Blog: An Indie Game Developer's Somewhat Interesting ThoughtsStaff Reviewer for Game Tunnel

This topic is closed to new replies.

Advertisement