473,387 Members | 3,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Game Trees for Simple games

Hello, i have a question about game trees. I've been given an assignment in class (highschool) and the assignment is to write a program the simulates The Game Of Eight. The game runs like this:

player gets a choice to go first or second
player picks first
player can choose either 1 2 3
player picks 1
// computer now has 2 choices 2,3
computer picks 2
//player can now pick 1,2 or 3 again
etc.

So the game flow is player picks - computer picks - player - computer - etc. until someone reaches or exceeds the number 8. if the user or computer goes over then the other opponent wins. If someone gets 8 exactly then that player wins. Now the actual question: I want to use a game tree to represent the possible ways the game could go, and then have the computer player use that to decide it's move. The problem, I have no idea how to implement tree's in C++.
Well, i have a little (very little) knowledge of how a minmax type tree works and I know it best suits games where the entire board is known to both players like in chess. Would this be the best choice of tree to use? should I use another approach (different type of tree)? If I should use an alternate approach then what are some resources that I can look at for some guidance? If I should use another approach then can someone explain that method to me in simple terms. I don't want any source but simple written explanations would be very much appreciated. Please let me know if more info is required.

thanks.
Nov 28 '07 #1
1 2300
weaknessforcats
9,208 Expert Mod 8TB
The problem, I have no idea how to implement tree's in C++.
The trees aree already coded if you use the standard containers like map or multimap.
Nov 28 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: me | last post by:
Hey all, I am making a 4 in a row game in flash MX. Wel i do it a bit pimitief like sending respons from the swf file to the php-mysql handler to see if the other user has make a move. I...
138
by: theodp | last post by:
--> From http://www.techdirt.com/articles/20040406/1349225.shtml Microsoft Patents Saving The Name Of A Game Contributed by Mike on Tuesday, April 6th, 2004 @ 01:49PM from the...
5
by: sundew | last post by:
Here I am presenting you the new Wednus proj. subtree, Wednus DHTML RPG engine, or just 'Wednus RPG' with a demo game using the engine. About the engine itself, since this DHTML game engine...
0
by: Jeff Rush | last post by:
At PyCon this year we're going to have a multi-day game programming clinic and challenge. This is a first-time event and an experiment to find those in the Python community who enjoy playing and...
15
by: Hydrogenfussion | last post by:
I got into programming so i could program games.At first i just wanted to make simple games like Astaroids and stuff.Now I would like to learn to make Pro games. I still am not even good enough to...
14
by: v4vijayakumar | last post by:
In computer based, two player, board games, how to make computer play? Are there any formal ways to _teach_ computer, to choose best possible move? I know this is kind of off-topic here. Please...
6
by: pereges | last post by:
I want to begin by making simple 2D games for Dos. What particular features of C should I look to strengthen ? I am not asking about the graphics bit but in general.
7
by: Benjamin Vigneaux | last post by:
Well, I'm very interested in game development, I'm just starting out though, browsing here and there for tutorials, references, etc.. and learning about the game development industry... What...
2
by: LilMeechc20 | last post by:
Hello, I have a group assignment that I have to do. We have to write a Tic Tac Toe game. One person in my group has managed to write the code for a multiplayer (human -vs- human) game and I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.