diff --git a/starter_code/index.html b/starter_code/index.html
index a2f6656..ccda246 100755
--- a/starter_code/index.html
+++ b/starter_code/index.html
@@ -5,11 +5,11 @@
-
+
-
+
-
+
diff --git a/starter_code/script.js b/starter_code/script.js
index 839d178..63ddab4 100755
--- a/starter_code/script.js
+++ b/starter_code/script.js
@@ -3,13 +3,29 @@ var aiPoint = 0;
// This function returns the selection of the computer
function getAISelection() {
- //TODO: randomly choose between 'rock', 'paper', or 'scissors'
+ var options = ["rock","scissors","paper"];
+ var random = Math.floor(Math.random() * (0 - 3 + 1)) + 0;
+ return options[random];
}
// This function picks the winner
function pickWinner(userValue, aiValue) {
//TODO: pick the correct winner: user or ai
//TODO: Add one point for the winner
+ if(userValue == "rock" && aiValue == "paper"){
+ return "winner";
+ userPoint += 1;
+ }else if(userValue == "scissors" && aiValue == "paper"){
+ return "winner";
+ userPoint += 1;
+ }else if(userValue == "paper" && aiValue == "rock"){
+ return "winner";
+ userPoint += 1;
+ }else if(userValue == aiValue){
+ return "draw";
+ }else{
+ aiPoint += 1;
+ }
}
// This function sets the scoreboard with the correct points