473,224 Members | 1,352 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,224 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

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.

Nov 28 '07 #1
1 2287
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

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...
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...
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...
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...
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...
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...
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.
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...
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...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.