i'm new to c++, but am taking a intro to computer science class. we have to write a 2 player game. Game Rules: There are three stacks (A, B and C) of sticks on the table. Each stack is initialized with a random number of sticks between 3 and 10 (inclusive). Each player takes turns choosing a stack and taking a number of sticks form that stack. A player may take either ONE stick or TWO sticks from that (selected) stack. After a player has removed a number of sticks from a stack, play is then passed to the other player. The game continues as long as there are sticks in any one of the stacks.
I dont know where to start. is there someone who could steer me in the right direction on how to start? any help would be greatly appreciated. it's for a console btw.

6 Years
Discussion Span
Last Post by eme21

You need 3 stacks, so therefore why not have 3 variables to mimic these stacks.

Each variable needs to contain a random number between 3 and 10. There are many examples of how to generate random numbers. Use these examples.

Think of a way to check which players turn it is(e.g. with bool) and request input from the user. Do the necessary calculations to your variables. Making sure the user can only remove at most 2 sticks and at least 1.

Lastly, you need a test to see if the game is complete, i.e. if either A,B,C = 0.

Do-while/while loops are very useful for this type of program.


you are like me

Ask Allah to help you and it will be easy.
think and try to do it alone.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.