Graphics Version of Twenty One

You can use these gifs of dice faces or you can choose others. They must be called 1.gif, 2.gif, 3.gif, etc. The gif for the "pass" move must be named 0.gif. You won't have to upload them; we will have our own copies of the images.

You should NOT have to change the program logic in any substantial way. Loops are still where they are; ifs are still the same logic.

Make sure that the function cleans up after itself. All prompts, messages and Entry boxes should be undrawn before the function returns.

Feel free to be creative with the design of the game. Colors, fonts, locations, etc. are up to you. The only requirements are that you have the information on the screen at the appropriate times as shown in the screen shots below.

Screen Shots

Changes to existing functions

Changes to play_turn:

Changes to main function:

Changes to pass_or_roll:

Two New Functions

Cleanup

You notice in the screen captures that all the information that is displayed is "clean". This means that it is NOT just displayed on top of the old values that were there. When the Points changes from 2 to 3, the 3 is not displayed on top of the 2. You can use setText very nicely here. Hint: set up your Text objects before you enter the main game loop. Put blank strings in them and give them their locations.

  • If you need for the message to stay on the screen most of the time, like "Points", draw the Text object before the loop starts. When you are ready in the loop to change the value of the Points, and use setText to change the string in the object.