Skip to content

Instantly share code, notes, and snippets.

@koraduba7
Created November 20, 2021 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koraduba7/364280a36d0e891f576b318e05feb0b9 to your computer and use it in GitHub Desktop.
Save koraduba7/364280a36d0e891f576b318e05feb0b9 to your computer and use it in GitHub Desktop.
let humanScore = 0;
let computerScore = 0;
let currentRoundNumber = 1;
// Write your code below:
function generateTarget(){
return Math.floor(Math.random() * 9);
}
let compareGuesses = (humanGuess, computerGuess, secretGuess) => {
if(Math.abs(humanGuess - secretGuess) <= Math.abs(computerGuess - secretGuess)){
return true;
} else {
return false;
}
}
let updateScore = (winner) => {
if(winner === 'human'){
humanScore++;
} else {
computerScore++;
}
}
function advanceRound(){
currentRoundNumber++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment