Skip to content

sierrajulietromeo/PRG1-RPS-JS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Task 1 - Rock Paper Scissors

Create a single function (the skeleton has been provided for you). The function must be capable of 'playing' a single round of the classic game 'Rock, Paper, Scissors':

Rock beats Scissors, Scissors beats paper, Paper beats rock

When called, the function should return the winning player reference (i.e., 'player1' or 'player2' or 'draw') as a single string.

Evidence of testing is expected. You should test your solution by making sufficient calls to your function so that you are positive that it works as expected. These should be left at the bottom of rps.js commented out.

Your final version should demonstrate evidence of being refactored; please note, refactoring is not bug-fixing - essentially it is reducing complexity and simplifying your codebase such that it is as efficient, readable, structured and as manageable as possible.

Some example calls to the function:

rock_paper_scissors("paper", "paper")    # should return "draw"
rock_paper_scissors("scissors", "paper")  # should return "player1"
rock_paper_scissors("paper", "scissors")  # should return "player2"

Additional criteria.

Once you have the basic version working, extend your function so that it supports Sheldon Cooper's 'Big Bang' version 'Rock, Paper, Scissors, Lizard, Spock'. Remember to write the tests!

Picture of Big Bang Rules

Submission Checklist

Prior to actually submitting your final attempt you should ensure you have reviewed and considered the following checklist.

  1. Refactored rock_paper_scissors function.
  2. Does your solution follow accepted coding conventions?
  3. Your 'test' code, commented out at the bottom of rps.js

Releases

No releases published

Packages

No packages published