Wood_SimpleGame

.docx

School

Lone Star College System, Woodlands *

*We aren’t endorsed by this school

Course

1315

Subject

Computer Science

Date

Feb 20, 2024

Type

docx

Pages

6

Uploaded by MateBat2484

Submission Document Template: Part 1: Enter the following general information to be included Student Name: Daniel Wood Class Number: ITSE 1302 Assignment Name: Simple Game Program Type: Minor Insert Assignment Requirements Below Here Copied from Assignment Document: (Worth 5 Points) Program: Simple Game Program Worth 25 points Description: You want to create a game for 2 people that uses a single dice roll to move you around the 20 space board. However, as the player goes from start to finish, occasionally they will be given a "chance" opportunity: player is asked to guess whether or not the roll is even or odd. If player is correct, they move forward the original spaces rolled. If they fail, they move back the number of spaces rolled. The first player to reach the end, wins. Requirements: Standard Requirements: o Includes comments for each section of code specifying input, process, and output for each: o Initialize all variables prior to usage o Use constants instead of literals: MAX_SPACES = 20, etc. o Code separated into IPO sections, and appropriate comments. o NOTE : Do not use any Python programming techniques that we have not yet covered in class. This includes special operators/functions, lists, arrays, and tuples: basically cool shortcuts that replace techniques we have been using in class, (Not because the cool shortcut is not useful and time-saving, but because I need to see that you understand the underlying concepts.) Use functions to: o ask for players names o Roll dice to determine spaces; if dice value is evenly divisible by 3, player should perform "chance" task o Perform even/odd task: player guesses even or odd; dice is rolled. If result matches guess, return a value that indicates player should move forward the original number of spaces rolled. Otherwise, return value indicating player should move the original number of spaces rolled backward. o Print result of each play for each each player. (See sample output)
Sample Input/Output: Enter name of player 1: Joe Enter name of player 2: Sue Round 1: Joe rolls the dice and gets 4 Joe moves 4 spaces forward and is now on space 4 Sue rolls the dice and gets 5 Sue moves 5 spaces forward and is now on space 5 Round 2: Joe rolls the dice and gets 2 Joe moves 2 spaces forward and is now on space 6 Sue rolls the dice and gets 3 Chance Opportunity: Guess whether the next roll of the dice will be odd or even: even The dice roll is 5 which is odd Sue goes back 3 spaces and is now on space 2 Round 3: Joe rolls the dice and gets 5 Joe moves 2 spaces forward and is now on space 11 Sue rolls the dice and gets 4 Sue moves 4 spaces and is now on space 6 Round 4: Joe rolls the dice and gets 6 Chance Opportunity: Guess whether the next roll of the dice will be odd or even: odd The dice roll is 1 which is odd Joe moves 6 spaces forward and is now on space 17 Sue rolls the dice and gets 4 Sue moves 4 spaces and is now on space 10
Round 5: Joe rolls the dice and gets 4 Joe moves 4 spaces forward and is now on space 21 Sue rolls the dice and gets 5 Sue moves 5 spaces and is now on space 15 End of Game! Joe wins on space 21 Sue is on space 15 Part 2: Analysis and Design (Worth 10 points) An IPO chart containing significant steps and formulas used to create program OR pseudo code containing significant steps and formulas used to create program. It should not be your actual source code copied into the chart … it should be your plan for the source code not written in python. Insert IPO or pseudo code below Here: (Worth 10 Points) Main() Step 0: Initialization Step 1: Input Step 2: Process Step 3: Output userName1 = str userName1 While user1Square or user2Square >= 20 Turn results userName2 = str userName2 take a turn (user1) sets new user1Square user1Square = int(0) take a turn (user2) sets new user2Square user2Square = int(0) Declare winner Winner results LAST_SQUARE = int(20) Turn(userName, currentSquare) Step 0: Initialization Step 1: Input Step 2: Process Step 3: Output diceRoll input (userName roll the dice!) Return resultSquare to main currentSquare parameter diceRoll (random function) resultSquare Check for extra process (function) userName parameter resultSquare = currentSquare + diceRoll ExtraProcess(diceRoll) Step 0: Initialization Step 1: Input Step 2: Process Step 3: Output diceRoll (parameter) diceRoll (parameter) Ask user to guess even or odd newDiceRoll newDiceRoll Use random to roll dice Return new dice variable If user is correct, newDiceRoll = diceRoll Print what happened Else
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help