Create skeleton of game
This commit is contained in:
parent
92a325157f
commit
a5537d23d2
1 changed files with 38 additions and 0 deletions
38
script.js
38
script.js
|
|
@ -0,0 +1,38 @@
|
||||||
|
function getComputerChoice(){
|
||||||
|
// get random number between 1 and 3
|
||||||
|
// if 1, return "rock"
|
||||||
|
// if 2, return "paper"
|
||||||
|
// if 3, return "scissors"
|
||||||
|
}
|
||||||
|
|
||||||
|
function playRound(playerSelection, computerSelection){
|
||||||
|
//p = playerSelection.toLowerCase()
|
||||||
|
//c = computerSelection.toLowerCase()
|
||||||
|
|
||||||
|
// if player && comp === "rock", || if p && c === "paper" || p && c === "scissors" return "tie"
|
||||||
|
|
||||||
|
//else if p === "rock"
|
||||||
|
//if c === "paper" player loses
|
||||||
|
//else if c === "scissors" player wins
|
||||||
|
//else if p === "paper"
|
||||||
|
//if c === "scissors" player loses
|
||||||
|
//if c === "rock" player wins
|
||||||
|
//else (p === scissors)
|
||||||
|
//if c === "rock" player loses
|
||||||
|
//if c === "paper" player wins
|
||||||
|
}
|
||||||
|
|
||||||
|
function game(playerSelection, computerSelection) {
|
||||||
|
// for (var i = 0; i < 5; i++)
|
||||||
|
//playRound(playerSelection, computerSelection)
|
||||||
|
|
||||||
|
//count how many times p and c have won
|
||||||
|
|
||||||
|
//return whether or not p has won
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// const ps = prompt("Rock, Paper or Scissors?")
|
||||||
|
// const cs = getComputerChoice()
|
||||||
|
|
||||||
|
//console.log(game(ps, cs)) -
|
||||||
Loading…
Reference in a new issue