function guess(btn) {
  console.log("user guessed: " + btn);
  if (!gamePlaying) {
    return;
  }

  if (pattern[guessCounter] == btn) {
    //if the player guessed the correct color
    if (guessCounter == progress) {
      //there is still more patterns to go through keep going
      if (progress != pattern.length - 1) {
        progress++;
        playClueSequence();
      } else {
        //the player went through all the clues then they win
        winGame();
      }
    } else {
      //if the guess was correct and there are still more patterns to go through
      guessCounter++;
    }
  } else {
    
    mistakeCounter++;
    //console.log("number of mistakes: " + mistakeCounter);
    if(mistakeCounter<3){
      playClueSequence();
    }else{
      loseGame();// if the player excedes 3 mistakes they lose the game 
      //console.log("player is supposed to lose now");
    }
    
    }
  }
//checking each guess if its correct
checking each guess if its correct
checking each guess if its correct
function guess(btn) {
  console.log("user guessed: " + btn);
  if (!gamePlaying) {
    return;
  }
  if (pattern[guessCounter] == btn) {
    if (guessCounter == progress) {
      if (progress != pattern.length - 1) {
        progress++;
        playClueSequence();
      } else {
        winGame();
      }
    } else {
      guessCounter++;
    }
  } else {
    mistakeCounter++;
    if(mistakeCounter<3){
      playClueSequence();
    }else{
      loseGame();
    }
    }
  }
function guess ( btn ) { console . log ( "user guessed: " + btn ) ; if ( ! gamePlaying ) { return ; } if ( pattern [ guessCounter ] == btn ) { if ( guessCounter == progress ) { if ( progress != pattern . length - 1 ) { progress ++ ; playClueSequence ( ) ; } else { winGame ( ) ; } } else { guessCounter ++ ; } } else { mistakeCounter ++ ; if ( mistakeCounter < 3 ) { playClueSequence ( ) ; } else { loseGame ( ) ; } } }
checking each guess if its correct
checking each guess if its correct
//if the player guessed the correct color //there is still more patterns to go through keep going //the player went through all the clues then they win //if the guess was correct and there are still more patterns to go through //console.log("number of mistakes: " + mistakeCounter); // if the player excedes 3 mistakes they lose the game  //console.log("player is supposed to lose now");