async function makeGuess() {
    let guessResult = await ask(`Is your number ${computerGuess}? Enter Y for yes and N for no.`)
    
    // if guess is correct, end the game
    if (guessResult === 'Y') {
      console.log('Great, I guessed it!')
      process.exit();
    }
  // if guess is wrong, update range according to binary search 
  
    else {
      if (guessResult === 'N') {
        guessLoop();
      }

      async function guessLoop() {
        let rangeGuess = await ask('Is your number higher (H) or lower (L)?')
    
        // if secret number is higher than guess, remove all numbers below guess
        if (rangeGuess === 'H') {
          if (secretNumber < computerGuess) {
            console.log('The command line wizard just told me you\'re cheating! That\'s game over for me.');
            process.exit();
          }
          else {
            bottomOfRange = computerGuess + 1;
            let newGuess = randomNum(bottomOfRange, topOfRange);
            computerGuess = newGuess;
          }
        } 
    
        // likewise, if number is lower than guess, remove all numbers above guess
        else if (rangeGuess === 'L') {

          if (secretNumber > computerGuess) {
            console.log('The command line wizard just told me you\'re cheating! That\'s game over for me.');
            process.exit();
          }
          else {
          topOfRange = computerGuess -1;
          let newGuess = randomNum(bottomOfRange, topOfRange);
          computerGuess = newGuess;
          }
        };

        makeGuess();
      }; 
    };

  }
// ask human whether guess is correct or not
ask human whether guess is correct or not
ask human whether guess is correct or not
async function makeGuess() {
    let guessResult = await ask(`Is your number ${computerGuess}? Enter Y for yes and N for no.`)
    if (guessResult === 'Y') {
      console.log('Great, I guessed it!')
      process.exit();
    }
    else {
      if (guessResult === 'N') {
        guessLoop();
      }
      async function guessLoop() {
        let rangeGuess = await ask('Is your number higher (H) or lower (L)?')
        if (rangeGuess === 'H') {
          if (secretNumber < computerGuess) {
            console.log('The command line wizard just told me you\'re cheating! That\'s game over for me.');
            process.exit();
          }
          else {
            bottomOfRange = computerGuess + 1;
            let newGuess = randomNum(bottomOfRange, topOfRange);
            computerGuess = newGuess;
          }
        } 
        else if (rangeGuess === 'L') {
          if (secretNumber > computerGuess) {
            console.log('The command line wizard just told me you\'re cheating! That\'s game over for me.');
            process.exit();
          }
          else {
          topOfRange = computerGuess -1;
          let newGuess = randomNum(bottomOfRange, topOfRange);
          computerGuess = newGuess;
          }
        };
        makeGuess();
      }; 
    };
  }
async function makeGuess ( ) { let guessResult = await ask ( ` ${ computerGuess } ` ) if ( guessResult === 'Y' ) { console . log ( 'Great, I guessed it!' ) process . exit ( ) ; } else { if ( guessResult === 'N' ) { guessLoop ( ) ; } async function guessLoop ( ) { let rangeGuess = await ask ( 'Is your number higher (H) or lower (L)?' ) if ( rangeGuess === 'H' ) { if ( secretNumber < computerGuess ) { console . log ( 'The command line wizard just told me you\'re cheating! That\'s game over for me.' ) ; process . exit ( ) ; } else { bottomOfRange = computerGuess + 1 ; let newGuess = randomNum ( bottomOfRange , topOfRange ) ; computerGuess = newGuess ; } } else if ( rangeGuess === 'L' ) { if ( secretNumber > computerGuess ) { console . log ( 'The command line wizard just told me you\'re cheating! That\'s game over for me.' ) ; process . exit ( ) ; } else { topOfRange = computerGuess - 1 ; let newGuess = randomNum ( bottomOfRange , topOfRange ) ; computerGuess = newGuess ; } } ; makeGuess ( ) ; } ; } ; }
ask human whether guess is correct or not
ask human whether guess is correct or not
// if guess is correct, end the game // if guess is wrong, update range according to binary search  // if secret number is higher than guess, remove all numbers below guess // likewise, if number is lower than guess, remove all numbers above guess