From d1d199a576abf4d03688c1f5c9ddce32197a8ff4 Mon Sep 17 00:00:00 2001 From: Alice Date: Wed, 13 May 2026 16:57:19 +0300 Subject: [PATCH] version 1 --- Project/index.html | 9 +++++++++ Project/main.js | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 Project/index.html create mode 100644 Project/main.js diff --git a/Project/index.html b/Project/index.html new file mode 100644 index 0000000..5948560 --- /dev/null +++ b/Project/index.html @@ -0,0 +1,9 @@ + + + Игрульки + + +

Вас приветствует игра "Камень, Ножницы, Бумага"

+ + + \ No newline at end of file diff --git a/Project/main.js b/Project/main.js new file mode 100644 index 0000000..00e4e12 --- /dev/null +++ b/Project/main.js @@ -0,0 +1,39 @@ +let hum = prompt('Выберите "камень", "ножницы" или "бумага"'); +let npc = Math.floor(Math.random() * 3) + 1; + +console.log(npc); +console.log(hum); + +const Stone = { num: 3, Name: 'камень' }; +const Scissors = { num: 2, Name: 'ножницы' }; +const Paper = { num: 1, Name: 'бумага' }; + + +if (hum === Stone.Name) { + hum = Stone.num; +} else if (hum === Scissors.Name) { + hum = Scissors.num; +} else if (hum === Paper.Name) { + hum = Paper.num; +}; + + +if (npc === 1 && hum === 3) { + npc = 4 +} +if (npc === 3 && hum === 1) { + hum = 4 +} + +if (npc > hum) { + console.log("Вы проиграли"); + alert("Вы проиграли"); +} else if (npc === hum) { + console.log("Ничья"); + alert("Ничья"); +} else if (npc < hum) { + console.log("Вы выиграли"); + alert("Вы выиграли"); +} else { + console.log("Пользователь написал какую-то фигню"); +} \ No newline at end of file