CSE 111 - Fall 2002

Lab #10 - Pick Up Sticks

 

Background

For this lab, you will be a contestant in Survivor Thailand.  One of the challenges this season was a game of Pick Up Sticks.  The board starts out with 21 sticks.  There are two players.  The players take turns selecting 1,2, or 3 sticks on each turn.  The object of the game is to leave the last stick on the board when it is your turn.  One of the players is the user, the other is the computer.  The human player begins.  The game is over when only one stick remains on the board.

You should find an image for your sticks.  You can arrange the sticks any way on the board, and they can be removed in any order.  The users select one, two or three sticks by selecting from the radio buttons.  

The computer player should be somewhat smart in this game.  For example, if there are four sticks on the board when it is the computer player's turn, the computer should take 3 sticks.  This will cause a win for the computer.  Similar strategies can be derived for other numbers of sticks left on the board.  It will be easy to decide what the computer should do for 2,3,4 sticks.  You should implement all these strategies.  You should also implement 3 other such strategies for the computer player when there are more than 4 sticks on the board.

Extra Credit

For additional credit, you should implement this game with more sticks, and a third player - either an additional smart computer player, or another human player.

Sample Interaction

Here are two screen shots of a sample interaction for this game.  These pictures are just to be used as a guide for how the game will be played.