-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathrock paper scissors
1 lines (1 loc) · 2.04 KB
/
rock paper scissors
1
javascript: var playerNum = prompt('Rock, Paper, Or Scissors?\n(1. Rock\n(2. Paper\n(3. Scissiors%27);var computerNum = Math.floor(Math.random() * 3) + 1;switch(playerNum) { case %271%27: var playerChoice = %27Rock%27; break; case %272%27: var playerChoice = %27Paper%27; break; case %273%27: var playerChoice = %27Scissors%27; break; default: alert(%27Input not found. Try inputting the number of your choice (I.E for Rock enter 1%27); break;}alert(%27Computer is choosing...%27);switch(computerNum) { case 1: var computerChoice = %27Rock%27; break; case 2: var computerChoice = %27Paper%27; break; case 3: var computerChoice = %27Scissors%27; break;}if (playerNum == 1) { if (computerNum == 1) { alert(%27Tie!\nYou chose %27 + playerChoice + %27 and the computer chose %27 + computerChoice); } if (computerNum == 2) { alert(%27You lost!\nYou chose %27 + playerChoice + %27 and the computer chose %27 + computerChoice); } if (computerNum == 3) { alert(%27You Won!\nYou chose %27 + playerChoice + %27 and the computer chose %27 + computerChoice); }}if (playerNum == 2) { if (computerNum == 1) { alert(%27You won!\nYou chose %27 + playerChoice + %27 and the computer chose %27 + computerChoice); } if (computerNum == 2) { alert(%27Tie!\nYou chose %27 + playerChoice + %27 and the computer chose %27 + computerChoice); } if (computerNum == 3) { alert(%27You lost!\nYou chose %27 + playerChoice + %27 and the computer chose %27 + computerChoice); }} if (playerNum == 3) { if (computerNum == 1) { alert(%27You lost!\nYou chose %27 + playerChoice + %27 and the computer chose %27 + computerChoice); } if (computerNum == 2) { alert(%27You won!\nYou chose %27 + playerChoice + %27 and the computer chose %27 + computerChoice); } if (computerNum == 3) { alert(%27Tie!\nYou chose %27 + playerChoice + %27 and the computer chose %27 + computerChoice); }}alert(%27Thank you for playing my bookmarklet game!\nMade by Legend7269\nMy Github: https://github.com/Legend7269/Bookmarklets%27);