2/6
var atacar= true;
var vosAcertas= Math.floor(Math.random()*2);
var lastimaEsteRound = Math.floor(Math.random()*5+1);
var perdidaTotal=0;
3/6
while(atacar){
atacar=false;
}
4/6
while(atacar){
if(vosAcertas){
console.log("Acertaste al dragón");
}else{
console.log("El dragón te pudo");
}
atacar=false;
}
5/6
var atacar=true;
var vosAcertas= Math.floor(Math.random()*2);
var lastimaEsteRound = Math.floor(Math.random()*5+1);
var perdidaTotal=0;
while(atacar){
if(vosAcertas){
console.log("Acertaste al dragón");
perdidaTotal+=lastimaEsteRound;
if(perdidaTotal>=4){
console.log("Has derrotado al dragón");
atacar=false;
}else{
vosAcertas= Math.floor(Math.random()*2);
}
}else{
console.log("El dragón te pudo");
}
atacar=false;
}