6. You did it


#1



Ok, I need help.
My Mini-Game is done but after I tinkered with it a bit the last part broke.
After I get the last prompt for ROCK PAPER SCISSORS, it doesn't log the "paper wins" or "scissors wins" anymore. I set a timer for that prompt, don't know if thats causing the problem. 
Please go through my code and don't hate me for it's length.
Thanks

var user = prompt("You are retarded a Derp as some People say, you have no purpose, on your journey to the lost Doge you come across a room you hear a sound (Player DOGE has entered the Arena!)\" \"Many kill, much dead\"\"What do you do? OFFER KATE, RUN, MANY DOGE; PRAY TO DOGE or YOU DIED?").toUpperCase();

switch(user) {
    case 'Offer Kate'.toUpperCase():
        
        if(blue&&red) {
            console.log("Kate many sad, Kate hate!");
        }
        else {
            console.log("Kate forgive, Kate Looooooove");
        }
       break;
       
        console.log("Kate many sad, Kate hate!"); 
        break;
        
        
    case 'Run'.toUpperCase():
        
        if(blue&&red) {
            console.log("U try too run, but doge us many disappoint!");
        }
        else {
            console.log("Hahahahahah you can not escape form Doge!!!!!!!");
        }
        break;
        
        console.log("U try too run, but doge us many disappoint!");
        break;
        
    case 'Many Doge'.toUpperCase():
        
        if(blue&&red) {
            console.log("Is this some kind of sick joke???");
        }
        else {
            console.log("U have a problem!");
        }
        break;
        
        console.log("Is this some kind of sick joke???");
        break;
        
    case 'Pray to Doge'.toUpperCase():
        if(blue || red) {
            console.log("Doge many amusement. You MAY not have to fight.");
        }
        else {
            console.log("Doge much laugh, doge many good.");
        }
        break;
       
        console.log("Doge many amusement. You MAY not have to fight.");
        break;
        
    case 'You Died'.toUpperCase():
        
        if(blue&&red) {
            console.log("WTF! WHY? NO!");
        }
        else {
            console.log("No! This isn't Dark Souls.(Yes it is)");
        }
         break;
        
        console.log("WTF! WHY? NO!");
        break;
        
    default:
        console.log("Can't even answer a simple question?! I mean come on... I gave you the answer! UUggghh... Fine, you fight!");
        
}
        
var blue = Math.floor(Math.random() * 2);
var red = Math.floor(Math.random() * 2);  
        
        
      var slaying = true;
// A bit of new math magic to calculate the odds
// of hitting the dragon. We'll cover this soon!
var youHit = Math.floor(Math.random() * 2);
var damageThisRound = Math.floor(Math.random() * 5 + 1);
var totalDamage = 0;

while (slaying) {
  if (youHit) {
    console.log("You hit Doge (many ow) and did " + damageThisRound + " damage!");
    totalDamage += damageThisRound;
    
    if (totalDamage >= 4) {
      console.log("You did it! You slew doge!");
      slaying = false;
    } else {
      youHit = Math.floor(Math.random() * 2);
    }
  } else {
    console.log("Doge Dank memes you! You're MLG Pro R3KT.");
    break;
    //slaying = false;
  }
}  
     console.log("After your battle you and Doge play a friedly round of ROCK, PAPER, SCISSORS.");

setTimeout(function(){
    var userChoice = prompt("Do you choose rock, paper or scissors? DOGE is waiting");
var computerChoice = Math.random();
if (computerChoice < 0.34) {
	computerChoice = "rock";
} else if(computerChoice <= 0.67) {
	computerChoice = "paper";
} else {
	computerChoice = "scissors";
} console.log("Computer: " + computerChoice);

var compare = function (choice1, choice2) {
    if (choice1 === choice2) {
        return "You both get REKT! Only Kate is MLG PRO QUICKSCOOPER!!!!";
    } else if (choice1 === "rock") {
    	if (choice2 === "scissors") {
    		return "rock is OP, ultimate win!!!!!";
    	} else {
    		return "paper REKS, many win";
        }
    }else if (choice1 === "paper") {
        if (choice2 === "rock") {
            return "paper wins";
        }   else {
            return "scissors is many win";
        }
    }
    
  else if (choice1 === "scissors") {
        if (choice2 === "rock") {
        return "rock many smash, much win";
}
        else {
        return "scissors many cut, many win";
        }
    }
};


compare(userChoice, computerChoice)
    }, 2000)


#3

you are right timer is causing problem

var user = prompt("You are ■■■■■■■■ a Derp as some People say, you have no purpose, on your journey to the lost Doge you come across a room you hear a sound (Player DOGE has entered the Arena!)\" \"Many kill, much dead\"\"What do you do? OFFER KATE, RUN, MANY DOGE; PRAY TO DOGE or YOU DIED?").toUpperCase();

switch(user) {
case 'Offer Kate'.toUpperCase():

    if(blue&&red) {
        console.log("Kate many sad, Kate hate!");
    }
    else {
        console.log("Kate forgive, Kate Looooooove");
    }
   break;

    console.log("Kate many sad, Kate hate!"); 
    break;


case 'Run'.toUpperCase():

    if(blue&&red) {
        console.log("U try too run, but doge us many disappoint!");
    }
    else {
        console.log("Hahahahahah you can not escape form Doge!!!!!!!");
    }
    break;

    console.log("U try too run, but doge us many disappoint!");
    break;

case 'Many Doge'.toUpperCase():

    if(blue&&red) {
        console.log("Is this some kind of sick joke???");
    }
    else {
        console.log("U have a problem!");
    }
    break;

    console.log("Is this some kind of sick joke???");
    break;

case 'Pray to Doge'.toUpperCase():
    if(blue || red) {
        console.log("Doge many amusement. You MAY not have to fight.");
    }
    else {
        console.log("Doge much laugh, doge many good.");
    }
    break;

    console.log("Doge many amusement. You MAY not have to fight.");
    break;

case 'You Died'.toUpperCase():

    if(blue&&red) {
        console.log("WTF! WHY? NO!");
    }
    else {
        console.log("No! This isn't Dark Souls.(Yes it is)");
    }
     break;

    console.log("WTF! WHY? NO!");
    break;

default:
    console.log("Can't even answer a simple question?! I mean come on... I gave you the answer! UUggghh... Fine, you fight!");

}

var blue = Math.floor(Math.random() * 2);
var red = Math.floor(Math.random() * 2);

  var slaying = true;

// A bit of new math magic to calculate the odds
// of hitting the dragon. We'll cover this soon!
var youHit = Math.floor(Math.random() * 2);
var damageThisRound = Math.floor(Math.random() * 5 + 1);
var totalDamage = 0;

while (slaying) {
if (youHit) {
console.log("You hit Doge (many ow) and did " + damageThisRound + " damage!");
totalDamage += damageThisRound;

if (totalDamage >= 4) {
  console.log("You did it! You slew doge!");
  slaying = false;
} else {
  youHit = Math.floor(Math.random() * 2);
}

} else {
console.log("Doge Dank memes you! You're MLG Pro R3KT.");
break;
//slaying = false;
}
}
console.log("After your battle you and Doge play a friedly round of ROCK, PAPER, SCISSORS.");

var userChoice = prompt("Do you choose rock, paper or scissors? DOGE is waiting");
var computerChoice = Math.random();
if (computerChoice < 0.34) {
computerChoice = "rock";
} else if(computerChoice <= 0.67) {
computerChoice = "paper";
} else {
computerChoice = "scissors";
} console.log("Computer: " + computerChoice);

var compare = function (choice1, choice2) {
if (choice1 === choice2) {
return "You both get REKT! Only Kate is MLG PRO QUICKSCOOPER!!!!";
} else if (choice1 === "rock") {
if (choice2 === "scissors") {
return "rock is OP, ultimate win!!!!!";
} else {
return "paper REKS, many win";
}
}else if (choice1 === "paper") {
if (choice2 === "rock") {
return "paper wins";
} else {
return "scissors is many win";
}
}

else if (choice1 === "scissors") {
if (choice2 === "rock") {
return "rock many smash, much win";
}
else {
return "scissors many cut, many win";
}
}
};

compare(userChoice, computerChoice)


#4

Do you have a solution?


#5

what solution do you need?


#6

I'd like to have a timer on my second prompt with the last part of my code running correctly.

I'd do it myself but I'm just not experienced enough.


#7

run it

var user = prompt("You are retarde a Derp as some People say, you have no purpose, on your journey to the lost Doge you come across a room you hear a sound (Player DOGE has entered the Arena!)\" \"Many kill, much dead\"\"What do you do? OFFER KATE, RUN, MANY DOGE; PRAY TO DOGE or YOU DIED?").toUpperCase();

switch(user) {
case 'Offer Kate'.toUpperCase():

    if(blue&&red) {
        console.log("Kate many sad, Kate hate!");
    }
    else {
        console.log("Kate forgive, Kate Looooooove");
    }
   break;

    console.log("Kate many sad, Kate hate!"); 
    break;


case 'Run'.toUpperCase():

    if(blue&&red) {
        console.log("U try too run, but doge us many disappoint!");
    }
    else {
        console.log("Hahahahahah you can not escape form Doge!!!!!!!");
    }
    break;

    console.log("U try too run, but doge us many disappoint!");
    break;

case 'Many Doge'.toUpperCase():

    if(blue&&red) {
        console.log("Is this some kind of sick joke???");
    }
    else {
        console.log("U have a problem!");
    }
    break;

    console.log("Is this some kind of sick joke???");
    break;

case 'Pray to Doge'.toUpperCase():
    if(blue || red) {
        console.log("Doge many amusement. You MAY not have to fight.");
    }
    else {
        console.log("Doge much laugh, doge many good.");
    }
    break;

    console.log("Doge many amusement. You MAY not have to fight.");
    break;

case 'You Died'.toUpperCase():

    if(blue&&red) {
        console.log("WTF! WHY? NO!");
    }
    else {
        console.log("No! This isn't Dark Souls.(Yes it is)");
    }
     break;

    console.log("WTF! WHY? NO!");
    break;

default:
    console.log("Can't even answer a simple question?! I mean come on... I gave you the answer! UUggghh... Fine, you fight!");

}

var blue = Math.floor(Math.random() * 2);
var red = Math.floor(Math.random() * 2);

  var slaying = true;

// A bit of new math magic to calculate the odds
// of hitting the dragon. We'll cover this soon!
var youHit = Math.floor(Math.random() * 2);
var damageThisRound = Math.floor(Math.random() * 5 + 1);
var totalDamage = 0;

while (slaying) {
if (youHit) {
console.log("You hit Doge (many ow) and did " + damageThisRound + " damage!");
totalDamage += damageThisRound;

if (totalDamage >= 4) {
  console.log("You did it! You slew doge!");
  slaying = false;
} else {
  youHit = Math.floor(Math.random() * 2);
}

} else {
console.log("Doge Dank memes you! You're MLG Pro R3KT.");
break;
//slaying = false;
}
}
console.log("After your battle you and Doge play a friedly round of ROCK, PAPER, SCISSORS.");

var delayedAlert= function() {
var timeoutID = window.setTimeout(settime, 2000);
}
delayedAlert();

function settime(){

var userChoice = prompt("Do you choose rock, paper or scissors? DOGE is waiting");
var computerChoice = Math.random();
if (computerChoice < 0.34) {
computerChoice = "rock";
} else if(computerChoice <= 0.67) {
computerChoice = "paper";
} else {
computerChoice = "scissors";
} console.log("Computer: " + computerChoice);

console.log(userChoice);

function compare(choice1, choice2) {
if (choice1 === choice2) {
console.log ("You both get REKT! Only Kate is MLG PRO QUICKSCOOPER!!!!");
} else if (choice1 === "rock") {
if (choice2 === "scissors") {
console.log ("rock is OP, ultimate win!!!!!");
} else {
console.log ("paper REKS, many win");
}
}else if (choice1 === "paper") {
if (choice2 === "rock") {
console.log ("paper wins");
} else {
console.log ("scissors is many win");
}
}

else if (choice1 === "scissors") {
if (choice2 === "rock") {
console.log ("rock many smash, much win");
}
else {
console.log ("scissors many cut, many win");
}
}

};
return compare(userChoice, computerChoice);
}


#8

it works thx
have a nice day