Камень ножницы бумага

Простой интерфейс игры Камень, ножницы, бумага

  1. // ==UserScript==
  2. // @name Камень ножницы бумага
  3. // @namespace http://tampermonkey.net/// ==UserScript==
  4. // @name Игра онлайн с ботом
  5. // @name Игра скотрит
  6. // @namespace http://tampermonkey.net/
  7. // @version 0.1
  8. // @description Простой интерфейс игры Камень, ножницы, бумага
  9. // @match *://*/*
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Создаем интерфейс для игры
  17. const gameInterface = document.createElement('div');
  18. gameInterface.style.position = 'fixed';
  19. gameInterface.style.bottom = '10px';
  20. gameInterface.style.right = '10px';
  21. gameInterface.style.backgroundColor = '#fff';
  22. gameInterface.style.border = '1px solid #000';
  23. gameInterface.style.padding = '10px';
  24. gameInterface.style.zIndex = '9999';
  25.  
  26. // Функция для генерации выбора компьютера
  27. function computerChoice() {
  28. const choices = ['камень', 'ножницы', 'бумага'];
  29. return choices[Math.floor(Math.random() * choices.length)];
  30. }
  31.  
  32. // Функция для обработки выбора игрока
  33. function playGame(playerSelection) {
  34. const compSelection = computerChoice();
  35. let result = '';
  36.  
  37. if (playerSelection === compSelection) {
  38. result = 'Ничья!';
  39. } else if ((playerSelection === 'камень' && compSelection === 'ножницы') ||
  40. (playerSelection === 'ножницы' && compSelection === 'бумага') ||
  41. (playerSelection === 'бумага' && compSelection === 'камень')) {
  42. result = 'Вы выиграли!';
  43. } else {
  44. result = 'Вы проиграли!';
  45. }
  46. alert(`Ваш выбор: ${playerSelection}\\nВыбор компьютера: ${compSelection}\\nРезультат: ${result}`);
  47. }
  48.  
  49. // Создаем кнопки для выбора игрока
  50. ['камень', 'ножницы', 'бумага'].forEach(choice => {
  51. const button = document.createElement('button');
  52. button.innerText = choice;
  53. button.onclick = () => playGame(choice);
  54. gameInterface.appendChild(button);
  55. });
  56.  
  57. document.body.appendChild(gameInterface);
  58. })();
  59. // @namespace http://tampermonkey.net/
  60. // @version 2024-10-03
  61. // @description try to take over the world!
  62. // @author You
  63. // @match http://*/*
  64. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  65. // @grant none
  66. // ==/UserScript==
  67.  
  68. (function() {
  69. 'use strict';
  70.  
  71. // Your code here...
  72. })();
  73. // @version 2024-11-03
  74. // @description try to take over the world!
  75. // @author You
  76. // @match http://*/*
  77. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  78. // @grant none
  79. // ==/UserScript==
  80.  
  81. (function() {
  82. 'use strict';
  83.  
  84. // Your code here...
  85. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址