version 1

This commit is contained in:
2026-05-13 16:57:19 +03:00
commit d1d199a576
2 changed files with 48 additions and 0 deletions
+39
View File
@@ -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("Пользователь написал какую-то фигню");
}