Sign in to follow this  

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

This topic is 4732 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
... 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,

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 4732 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this