> Programming: Python Pick Up Sticks game?

Programming: Python Pick Up Sticks game?

Posted at: 2014-12-18 
elif print("You must pick an appropriate number of sticks to take. (1-3)")

either needs to be an "else" or you need to add a condition. In either case you need a colon.

elif sticksint==2:

doesn't seem to match with an "if".

elif player1!=1

needs a colon

I don't have time to further analyze the code.

Try posting your code on something like http://pastebin.com/ or on github.com so that we can see your code to give some help!

My code is a piece of crap that either incessantly loops or does nothing at all. I didn't take enough time to prepare and am stuck with a deadline tonight. Any advice appreciated.

Assignment:

In this game, there is a heap of sticks between two players. On each players turn they may pick

up 1 to 3 sticks. The player who has to pick up the final stick will be the loser.

● You will ask the user if they want to play Player1 vs Player2 or Player1 vs a Computer

Opponent. If they enter an invalid choice, prompt them to enter again.

● Ask the player how many sticks to begin the game with. Valid choices are 10-50. If they

choose a number lower than 10 or greater than 50 the user will be prompted to enter the

choice again.

● Each player chooses the number of sticks on their turn. They are allowed to choose 1 to

3. If the number of sticks left is less than 3, then they are allowed to choose 1 to the

number left. If they enter an invalid number then they are prompted again.

● If the player is an AI, then it will randomly choose 1 to 3 sticks, or 1 to the number of

sticks left.

● After each player picks a valid number of sticks. Display the player, how many sticks

they pulled, and how many are left.

● If there are no sticks left, then display the winner of the game.

● Once the game is over, ask the user if they want to play again. Valid entries are ‘Y’,

‘YES’, ‘y’, ‘yes’, ‘N’, ‘n’, ‘NO’, ‘no’. If the user enters anything else, ask them to enter a

valid choice.