Enjoy programming more!
Kidspod is a post site which supports young programmers.
First step to join us.
Register as a member
For members

2017/09/03 17:00:50

MixJuice GET URL : kidspod.club/mj/261

013

  • No registered tag exist.

SOURCE CODE

var win = 0;
var lose = 0;
var draw = 0;
var i = 0;
var r1;
var r2;
while (i < 10){
  r1 = rnd(5);
  r2 = rnd(5);
  log(r1);
  log(" vs ");
  log(r2);
  log("\n");
  if (r1 == r2){
    draw = draw + 1;
  }
  else if(r1 > r2){
    win = win + 1;
  }
  else{
    lose = lose + 1;
  }
  i = i + 1;
  sleep(500);
}
log("------");
log("\n");
log("win :");
log(win);
log("\n");
log("draw:");
log(draw);
log("\n");
log("lose:");
log(lose);
log("\n");

COMMENT