Published using Google Docs
2.4 - Game Show or Dice Game Assignment
Updated automatically every 5 minutes

2.3 Assignment 3 Game Show or Dice Game

Credit: Structured Programming 2

Option 1: Game Show Program - This is the simpler of the two projects.  If you are not fully confident with what we have learned so far (or are behind pace), then  you should tackle this assignment as it is a good practice.  

Option 2: Dice Game - For students who feel they are ready for a bigger challenge.  If you are ALREADY fully confident with text input and if statements, you may choose this option.

Both options will have 20% dedicated to the professionalism of the visuals.  You will lose 5% for each error or omissions related to the following:

Once you have made your choice, scroll down for instructions.


Option 1: Game Show

You are to create a multiple choice trivia question based game show where the user can earn more and more money for each question she gets correct.

Setting up your file

40% - Setting up your Questions

You will be asking  your user 5 questions.

Set up a title text and font.

In a different size and/or font - Print the 5 multiple choice trivia questions each with 3 or 4 choices.  (Remember more marks are awarded if you use scenes to handle each question one at a time)  Note:  

Next 40% - Marking the answers

You will be marking the questions and tracking the total number correct.

  1. Create a variable to track how many correct answers the user gets.

  1. Mark your Answers

Final 20%

Don’t forget the visual component discussed on the first page.


Option 2: Dice Game

The rules to this casino game are simple.  The player rolls a die; the casino rolls a die.  The higher number wins.  If it is a tie, the player wins big!  You might want to open the NumberGuess game Processing file to use as an example of working with random numbers.

Setting up your file

Instructions Area

Add the words “Your Name’s Casino” in a big font.

In a smaller, different font, write the following instructions:

        Hit the c key to roll the Casino’s die.

        Hit the p key to roll your die (P for player).

Hit the w key to see if you are a winner.

First 60% - Basic Game Play

You can create a text based game or one that uses pictures for the dice.  

KeyPressed Function

When the c key is pressed:

variable =  (int)(random(1,7) ;

When the p key is pressed

When the w key is pressed, use a 3 part if… else if… statement so that you tell the user:

How to add the pictures

You will need to import the 6 dice pictures from the S: Drive:  Computing Science\Images

Set Up Your Images Area

In this version you need to allocate some space to hold the pictures of the dice.  

  1. Add text that says Casino’s Roll:  and Player’s Roll:
  2. Draw squares beside each of the above labels that are big enough to hold the pictures (perhaps 200x200).  For now, these squares will be empty.  The pictures will go in the boxes.

Adding to the KeyPressed Function

When the c key is pressed:

When the p key is pressed

No new code is needed for the w key.

Next 20% - Adding Betting

For this stage you will need at least 2 additional variables.  You must also allow for multiple rounds with an appropriate reset key.

Before the w key is pressed, ask the user how many ‘hundreds of dollars’ they want to bet then set the bet variable in whatever way they choose (You can use single key presses where they bet 400 if they press 4, 300 if the press 3, etc. up to 900  OR    multidigit text entry to accept a specific bet)

Then, when the w key is pressed, change the messages so that it says the ‘casino wins your $5 hundred’ or ‘you win 500’ or something similar.

For full marks, you must also add the following features of the betting system:

Final 20%

Don’t forget the visual component discussed on the first page.