Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created November 3, 2021 19:36
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 codecademydev/6f87e6839bd896bd947ef821a183fd43 to your computer and use it in GitHub Desktop.
Save codecademydev/6f87e6839bd896bd947ef821a183fd43 to your computer and use it in GitHub Desktop.
Codecademy export
let humanScore = 0;
let computerScore = 0;
let currentRoundNumber = 1;
// Write your code below:
const generateTarget = () => {
return Math.floor(Math.random() * 10);
};
const compareGuesses = (guess1=null,guess2=null,num) => {
num=generateTarget();
console.log(num);
if (num===0) {
if (guess1 < guess2) {
return true;
} else {
return false;
}
}
if (guess1 % num === guess2 % num) {
return true;
}
if (guess1 % num > guess2 % num) {
return false;
}
if (guess1 % num < guess2 % num) {
return true;
}
};
const updateScore = str => {
switch (str) {
case 'human':
humanScore += 1;
break
case 'computer':
humanScore += 1;
break
}
};
const advanceRound = () => {
currentRoundNumber += 1;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment