By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,146 Members | 1,738 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,146 IT Pros & Developers. It's quick & easy.

Game Trees for Simple games

P: 1
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
Share this Question
Share on Google+
1 Reply


weaknessforcats
Expert Mod 5K+
P: 9,197
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

Post your reply

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