Jump to content

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

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

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
8 replies to this topic

#1 ballack   Members   

100
Like
0Likes
Like

Posted 01 January 2005 - 07:23 PM

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.

#2 Nice Coder   Members   

366
Like
0Likes
Like

Posted 01 January 2005 - 07:56 PM

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

#3 flangazor   Members   

516
Like
0Likes
Like

Posted 02 January 2005 - 01:15 PM

It has come to my attention that tic tac toe is a common introduction to programming assignment at some schools.

#4 nprz   Members   

692
Like
0Likes
Like

Posted 02 January 2005 - 05:13 PM

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.

#5 Emmanuel Deloget   Members   

1381
Like
0Likes
Like

Posted 02 January 2005 - 10:53 PM

... 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,

#6 vinb   Members   

218
Like
0Likes
Like

Posted 03 January 2005 - 01:01 AM

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

#7 GBGames   Members   

217
Like
0Likes
Like

Posted 03 January 2005 - 05:10 AM

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

#8 coldacid   Members   

755
Like
0Likes
Like

Posted 03 January 2005 - 05:15 AM

GBGames: Any chance that the language in question is QuickBasic?

#9 GBGames   Members   

217
Like
0Likes
Like

Posted 03 January 2005 - 04:41 PM

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




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.