Andrey0189

Untitled

Jun 6th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   if (['rsp', 'кнб', 'кыз'].includes(command)) {
  2.         let userChoice;
  3.                 if (['камень', 'rock', 'r', 'к'].includes(args[0].toLowerCase())) {
  4.                     userChoice = 'камень';
  5.                 }
  6.                 else if (['бумагу', 'бумага', 'paper', 'p', 'б'].includes(args[0].toLowerCase())) {
  7.                     userChoice = 'бумагу';
  8.                 }
  9.                 else if (['scissors', 'ножницы', 's', 'н'].includes(args[0].toLowerCase())) {
  10.                     userChoice = 'ножницы';
  11.                 }
  12.                 else if (!args[0]) {
  13.                     message.channel.send('Вы забыли указать что вы выбираете, камень, ножницы или бумагу');
  14.                     return;
  15.                 }
  16.                 else {
  17.                     userChoice = 'Incorrect';
  18.                 }
  19.                 let computerChoice = Math.random();
  20.                 if (computerChoice < 0.34) {
  21.                     computerChoice = "камень";
  22.                 } else if(computerChoice <= 0.67) {
  23.                     computerChoice = "бумагу";
  24.                 } else {
  25.                     computerChoice = "ножницы";
  26.                 } message.channel.send("Я выбрал " + computerChoice);
  27.                 function rspCW(userChoice, computerChoice) {
  28.                     if (userChoice === computerChoice) {
  29.                         return "ничья!";
  30.                     }
  31.                     else if(userChoice === "камень") {
  32.                         if(computerChoice === "ножницы") {
  33.                             return "ты выиграл!";
  34.                         }
  35.                         else if (computerChoice === "бумагу") {
  36.                             return "ты проиграл";
  37.                         }
  38.                     }
  39.                     else if(userChoice === "бумагу") {
  40.                         if(computerChoice === "камень") {
  41.                             return "ты выиграл!";
  42.                         } else if (computerChoice === "ножницы") {
  43.                             return "ты проиграл";
  44.                         }
  45.                     }
  46.                     else if(userChoice === "ножницы") {
  47.                         if(computerChoice === "бумагу") {
  48.                             return "ты выиграл!";
  49.                         } else if (computerChoice === "камень") {
  50.                             return "ты проиграл.";
  51.                         }
  52.                     }
  53.                     else if (userChoice === 'Incorrect') {
  54.                         return "ты не выбрал ни камень, ни ножницы, ни бумагу";
  55.                     }
  56.                 }
  57.                 if (userChoice === 'Incorrect') {
  58.                     message.channel.send(message.author + ", " + rspCW(userChoice, computerChoice))
  59.                 }
  60.                 else {
  61.                 message.channel.send(message.author + ", " + rspCW(userChoice, computerChoice) + ' Ты выбрал\(а\) ' + userChoice + ' Я выбрал ' + computerChoice);
  62.              }};
Advertisement
Add Comment
Please, Sign In to add comment