Created
September 16, 2020 14:20
-
-
Save Youssef19991/47ab4b52069aedd96cec21091ec7955a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let humanScore = 0; | |
let computerScore = 0; | |
let currentRoundNumber = 1; | |
// Write your code below: | |
function generateTarget() { | |
return Math.floor(Math.random() * 10); | |
} | |
function compareGuesses(usrGuess ,comGuess ,secNum) { | |
if (comGuess === secNum && usrGuess != secNum || Math.abs(usrGuess - secNum) > Math.abs(comGuess - secNum)) { | |
return false; | |
} else { | |
return true; | |
} | |
}; | |
function updateScore(winner) { | |
if (winner === "human") { | |
humanScore += 1; | |
} else { | |
computerScore +=1; | |
} | |
}; | |
function advanceRound() { | |
currentRoundNumber += 1; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment