diff --git a/TeamYeah b/TeamYeah new file mode 160000 index 0000000..fb5801b --- /dev/null +++ b/TeamYeah @@ -0,0 +1 @@ +Subproject commit fb5801b3b8992a72fc8a9aedef1f27531d08cfa3 diff --git a/class_3.js b/class_3.js index c6f8667..8c7ff23 100644 --- a/class_3.js +++ b/class_3.js @@ -1,9 +1,9 @@ var hands = ["rock", "paper", "scissors"]; function getHand() { - var myIndex = parseInt(Math.random()*10)%3; - return hands[myIndex]; - }; + + return hands[parseInt(Math.random()*10)%3]; + } var playerOne = { name: "mariah", @@ -11,16 +11,58 @@ var playerOne = { }; var playerTwo = { - name: "minaj" + name: "minaj", getHand: getHand }; -function playRound() { - console.log(playerOne.name, playerTwo) +var playerOneScore = 0 +var playerTwoScore = 0 + +function playRound(playerOne, playerTwo) { + playerOne = playerOne.hands() + playerTwo = playerTwo.hands() + var winner = 0; + if (playerOne = "Scissors" && playerTwo = "paper" || + playerOne = "Rock" && playerTwo = "Scissors" || + playerOne = "Paper" && playerTwo = "Rock"){ + winner = playerOne.name; + playerOne.winner++; + console.log("mariah played " + playerOne + "and minaj played" + playerTwo + "so the elusive chanteuse wins!"); + } + else if (playerOne !== playerTwo){ + winner = playerTwo.name; + playerTwo.winner++; + "mariah played " + playerOne + "and minaj played" + playerTwo + "so the rap queen wins!"); + + } + else if (playerOne === playerTwo){ + console.log("It's a tie"); + } + function playGame(playerOne, playerTwo, playUntil) { + // var gameWinner + while (playerOne.winner < playUntil && playerTwo.winner < playUntil) + playRound(playerOne, playerTwo) + if playerOne === playUntil console.log(playerOne.name + " wins the whole enchilada") + + else if playerTwo === playUntil + console.log("all friday's are pink from here on out, because" + playerTwo.name + wins it all) + } + // var calculator = { + // add: function(a,b) { + // return a + b; + // } + // } + // + // calculator.add(2,3) // 5 +playGame(playerOne, playerTwo, 5) + } }; +}; +function playRound() { + console.log(playerOne.name, playerTwo) -outer(); +};