Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 10-21-2006, 06:51 PM   #1 (permalink)
Hi.Im.New's Avatar
 
True Techie

Join Date: Dec 2004

Posts: 113

Hi.Im.New is on a distinguished road

Default Game design

So im creating a takeaway game for this project.

the theory of takeaway real quick:

Given in input a certain # of pennies > 0
can only takeaway in one turn 1 , 2 or 3 pennies
the person to takeaway the last penny loses

the human is first person to takeaway pennies.

every position has either a lose or win condition, meaning resulting from that
position if the user can win from it, its a win position , if theres no possible
way to win then its a lose position.

writin this in c++

im having trouble making the tree,

say i have 5 pennies then possible positions from this is 2 , 3 or 4
how do i make it so the nodes 2 , 3 and 4 point to the root or any node above it.
i keep getting errors using pointers.

thnx
Hi.Im.New is offline  
Old 10-23-2006, 02:20 AM   #2 (permalink)
 
True Techie

Join Date: May 2006

Location: Chicago IL

Posts: 104

thejeremy

Send a message via AIM to thejeremy
Default

So you're implementing this as a tree structure? That almost seems too...tedious. Why don't you simply subtract from the number of pennies left each time a player removes pennies? That would probably get rid of your need for pointers.
__________________
CPU: AMD Athlon 64 X2 5200+ Windsor, 2.6 GHz
RAM: CORSAIR XMS2 2GB 240-Pin DDR2
VIDCARD: EVGA PCI-Express x16 GeForce 7900GS 256MB
MOBO: ASUS M2N-SLI Deluxe AM2
HDD: Seagate Barracuda 320GB 7200 RPM SATA

my blog: http://jspot.gotdns.com
thejeremy is offline  
Old 10-23-2006, 08:47 AM   #3 (permalink)
Hi.Im.New's Avatar
 
True Techie

Join Date: Dec 2004

Posts: 113

Hi.Im.New is on a distinguished road

Default

It would seem that way , but were supposed to use a generic solver to solve any 2 player game (as far as in the spec for our project, they all ahve the same abstract attributes). in which case this is the first part of a 4 part project so thats why we have to use a tree because it keeps getting more difficult.

j
Hi.Im.New is offline  
Old 10-23-2006, 11:03 PM   #4 (permalink)
 
True Techie

Join Date: Nov 2005

Posts: 115

i_learn

Default

umm.....if u could elaborate a little more on what exactly u are tryin to get, as in, whats the question again!?? i dont follow.
i_learn is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On