Rock, Paper, Scissors Java Games

Tôm

Thành viên
Thành Viên
27/8/14
92
57
18
19
PHP:
var Userchoice = prompt("Rock, Paper, or Scissors")
;
var computerChoice = Math.random(); // generates a random number between 0 and 1 i believe
if (computerChoice <= 0.33{
console.log("ROCK");
}
if (computerChoice >= 0.66){
console.log ("SCISSORS");
}else{
console.log("PAPER")
{
//this brings our computerChoice to life Smiling next the tie!!
var compare = function (choice1, choice2){
if (compare(choice1) == compare(choice2)){
console.log("ITs A FRikkIn' Tie");
}
};
if (choice1 ==="rock"){
if (choice2 === "scissors"){
return "rock wins";
}else
return "paper wins";
}
}
};
if (choice1 === "scissors"){
if (choice2 === "rock"){
return "rock wins";
}else{
return "scissors wins";
}
};
 
  • Like
Reactions: vanthoi
Đang tải...

Quảng Cáo