I have 3 dice, I want when the number of dice <=10, will do something. And the number of dice >=11 will do another something so i try this code;
var x= Math.floor(Math.random() * 6)+1;
var y= Math.floor(Math.random() * 6)+1;
var z= Math.floor(Math.random() * 6)+1;
if(x+y+z <=10){
// do something
}else
{ // do another
}
And that code didn't work well. eg: x =2 y =4 z=6 , it will do both.
Aucun commentaire:
Enregistrer un commentaire