First Python Game, Dice Roller or Guess That Number

For your first python game assignment, you will either create a dice rolling simulator game, or a guess that number game. The dice rolling simulator is easier, so if you choose the guess that number game, you will get some bonus marks for completing it.

Dice rolling simulator game requirements:

This game simulates rolling dice and will keep a running total of the dice rolls as the user continues to play the game. When the program runs, the user will be asked:

a) Roll the dice

b) Quit the game

If the user chooses ‘a’, it will randomly choose a number between 1 and 6. (Or whatever other integer you prefer — the number of sides on the die is up to you.) The program will print what that number is. The program will also keep a running total of all dice throws since the start of the program, and it will print the total sum of all dice throws so far. For this project, you’ll need to set the min and max number that your dice can produce. For the average die, that means a minimum of 1 and a maximum of 6. You’ll also want a function that randomly grabs a number within that range and prints it. You’ll also want a variable that keeps track of the sum of dice throws.

Concepts to keep in mind:

  • Random
  • Integer
  • Print
  • Variables
  • Sums
  • While Loops

Guess that number requirements:

The program will first randomly generate a number unknown to the user. When the program runs, the user will be asked:

a) Guess a number between 1 and 100

b) Quit the game

If the user chooses ‘a’, then the user needs to guess what that number is. If the user’s guess is wrong, the program should return whether the number entered is too high or too low. If the user guesses correctly, a positive indication should appear. You’ll need functions to check if the user input is an actual number, to see the difference between the inputted number and the randomly generated numbers, and to then compare the numbers.

Concepts to keep in mind:

  • Random function
  • Variables
  • Integers
  • Input/Output
  • Print
  • While loops
  • If/Else statements

For either assignment, you will need to create pseudocode using the syntax we learned earlier in the year.

https://pmsscoding2016.wordpress.com/2016/10/05/pseudocode-part-2-assignment/

As an alternative to pseudocode, I will accept a program made by you in Snap! that simulates the same game (because block programming is essentially pseudocode).

This assignment is due next Wed Nov 30.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s