DEV Community

iBrendan!
iBrendan!

Posted on

Dev Journal - Day 1 - Odin Project - Rock Paper Scissors

Understanding the Problem
Rock Paper Scissors is a game played between 2 players, and for the purpose of this project, a user and the computer. For a single game round, each player simultaneously selects one of Rock, Paper, or Scissors. A winner is determined according to the following rules:

  • A selection of Paper beats Rock
  • A selection of Rock beats Scissors
  • A selection of Scissors beats Paper
  • else if both players make the same choice, the game is tied.

Pseudocode

1. Computer randomly plays “Rock”, “Paper” or “Scissors”
2. User inputs “Rock”, “Paper” or “Scissors”
3. Compare both player selections and assign a winner
4. If Rock and Paper are played, Paper wins
5. If Rock and Scissors are played, Rock wins
6. If Paper and Scissors are played, Scissors wins
7. If both selections are the same, game is a tie
8. Ensure Player’s selection-input is case insensitive
9. Ensure Player’s selection-input is case insensitive
10. Play 5 game rounds and determine final winner

Enter fullscreen mode Exit fullscreen mode

Concepts That Helped

  1. Array & String manipulation
  2. Functions
  3. Familiarity with conditional statements and comparisons
  4. String manipulation to ensure case-sensitivity validation using toLowerCase()
  5. Loops to keep count of multiple rounds and stop at 5 rounds
  6. Googling, Grit and Github

Link to Project Code

Challenges & Learning Moments

  1. Had no trouble creating the functions but struggled somewhat with looping them and displaying the score. Referenced previous attempts and discussions in the Odin Project server
  2. Learned Array & String manipulation as well as array.length property

Top comments (0)