The problem is that there is a user base that wishes play Rock, Paper, Scissors.
Implementation will involve these things:
- Zero-Sum Game Outcomes: The net status improvement for the players is "zero". I.e., in order for one player to WIN, the other must LOSE. Otherwise, both sides maintain status quo in a DRAW.
- Specific outcomes:
- Rock WINs against Scissors, which LOSEs to Rock
- Scissors WINs against Paper, which LOSEs to Scissors
- Paper WINs against Rock, which LOSEs to Paper
- SameTool* DRAWs against SameTool, which means both players LOSE (* "SameTool" being the event both players utilize the same weapon of play [e.g., scissors vs scissors])
- Specific outcomes:
This particular program will be an implementation of the game within a web broswer application (webapp) in a plain HTML/CSS/JS stack. The scope of the data used for the games accessibility, simplicity, and behavior allows for this software stack to be ideal for this.
1. Does your program have a user interface? What will it look like? What functionality will the interface have? Sketch this out on paper.
N/A for iteration one of the project
2. What inputs will your program have? Will the user enter data or will you get input from somewhere else?
-
The input will be user data.
-
The user data will be (text) strings that will be either one of three options:
- Rock
- Paper
- Scissors
Come to think of it, these could also be achieved with buttons later. However, in iteration one of the project, it will be a console application, so this "button" input idea will be deferred until later.
The desired output of the program is to:
- State which player (the user or the program) won the match
- What selection the user made (e.g. rock), and what selection the computer made (e.g. paper)
Algorithm here is to be copied as a comment and will probably be psuedocode:
INPUT userWeaponChoice from userPlayer from UI
INITIALIZE userWeaponChoice as an RPS (i.e., "Rock", "Paper", or "Scissors") value
COMPUTE userWeaponChoice from userNPC as a random RPS value
INITIALIZE computerWeaponChoice as a to the variable
CASE expression OF:
CONDITION 1 | The value of userWeaponChoice and computerWeaponChoice are the same:
SEQUENCE 1:
OUTPUT "DRAW"
CONDITION 2 | The value of userWeaponChoice is "Rock" and the value of computerWeaponChoice is "Paper"
SEQUENCE 2:
OUTPUT "LOSS"
CONDITION 3 | The value of userWeaponChoice is "Rock" and the value of computerWeaponChoice is "Scissors"
OUTPUT "WIN"
CONDITION 4 | The value of userWeaponChoice is "Paper" and the value of computerWeaponChoice is "Rock"
OUTPUT "WIN"
CONDITION 5 | The value of userWeaponChoice is "Paper" and the value of computerWeaponChoice is "Scissors"
OUTPUT "LOSS"
CONDITION 6 | The value of userWeaponChoice is "Scissors" and the value of computerWeaponChoice is "Rock"
OUTPUT "LOSS"
CONDITION 7 | The value of userWeaponChoice is "Scissors" and the value of computerWeaponChoice is "Paper"
OUTPUT "WIN"
ENDCASE