Difference between revisions of "CSC111 Homework 3 2014"

From dftwiki3
Jump to: navigation, search
(Problem #2: Test for invalid inputs)
(Submission)
Line 46: Line 46:
 
<br />
 
<br />
 
=Submission=
 
=Submission=
 +
<br />
 +
Always make sure your program runs before submitting it!!!
 +
 +
Make sure your program has a header at the top with
 +
# the name of the program
 +
# your two names
 +
# your two two-letter Id
 +
# a brief description of the program
 
<br />
 
<br />
 
Submit your programs to this link: [http://cs.smith.edu/~thiebaut/111b/submit2.php  cs.smith.edu/~thiebaut/111b/submit3.php].  The deadline is Thursday night 2/20/14, at midnight.
 
Submit your programs to this link: [http://cs.smith.edu/~thiebaut/111b/submit2.php  cs.smith.edu/~thiebaut/111b/submit3.php].  The deadline is Thursday night 2/20/14, at midnight.

Revision as of 22:53, 12 February 2014

--D. Thiebaut (talk) 21:23, 12 February 2014 (EST)


This assignment asks you to add new levels of testing with if-statements in the Rock-Paper-Scissors game.






Problem #1: Adding a mug to the game


This program will be called hw3a.py.

This program will allow the user to play a more sophisticated game where there is another option: a mug!

The new rules are the same as for the Rock-Paper-Scissors game, but with these additions:

  • Scissors fall in mug, and mug wins
  • Paper blocks mug, and paper wins
  • Rock breaks mug, and rock wins


Requirements


  1. Your program should recognize lowercase as well as uppercase inputs from the user.
  2. You can assume that the user will always enter the correct letters, and they can be upper- or lowercase.
  3. Your program should let the user play 3 rounds with the computer.
  4. Your program should keep track of who's is winning and print the winner of the 3 rounds at the end.


Problem #2: Test for invalid inputs

Your program will be called hw3b.py.

No mugs in this program!

Your assignment is to take the Rock-Paper-Scissors game from Lab 3 and to make sure it implements the following features (some part of Lab 3's program, some new):

  1. Your program should let the user play 3 rounds with the computer.
  2. Your program should keep track of who's is winning and print the winner of the 3 rounds at the end.
  3. Your program should accept upper or lower case inputs from the user. So r and R should be recognized as meaning Rock. Similarly for the other letters.
  4. If the user does not enter one of the valid inputs ('R', 'S', or 'P') the program will ask the user to enter a new character. The user has only one chance to correct the mistake. If the character entered the second time by the user is still not one of 'R', 'S', or 'P', the computer will automatically pick a random good character for the user, i.e. one of 'R', 'S', or 'P'.



Submission


Always make sure your program runs before submitting it!!!

Make sure your program has a header at the top with

  1. the name of the program
  2. your two names
  3. your two two-letter Id
  4. a brief description of the program


Submit your programs to this link: cs.smith.edu/~thiebaut/111b/submit3.php. The deadline is Thursday night 2/20/14, at midnight.