Game design

Status
Not open for further replies.

Hi.Im.New

In Runtime
Messages
118
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
 
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.
 
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
 
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.
 
Status
Not open for further replies.
Back
Top Bottom