Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created August 25, 2020 16:49
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/2f86ddf493ae3c05225aaa293596b8ca to your computer and use it in GitHub Desktop.
Save codecademydev/2f86ddf493ae3c05225aaa293596b8ca to your computer and use it in GitHub Desktop.
Codecademy export
let humanScore = 0;
let computerScore = 0;
let currentRoundNumber = 1;
// Write your code below:
let generateTarget = () => {
return Math.floor(Math.random() * 9);
};
let compareGuesses = (human, computer, secret) => {
let humanG = Math.abs(target - human);
let compG = Math.abs(target - computer);
return humanG <= compG;
if(humanG <= compG){
updateScore('human');
} else {
updateScore('computer');
}
};
let getAbsoluteDistance = (6, 3) => {
};
const updateScore = winner => {
if(winner === 'human') {
humanScore += 1;
} else {
computerScore += 1;
}
};
const advanceRound = () => {
const currentRoundNumber = advanceRound + 1;
};
updateScore('human');
console.log(humanScore);
updateScore('computer');
console.log(computerScore);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment