revert "Project Rock,Scissors,Paper" version 1

Signed-off-by: Alice <Svfoxel@yandex.ru>
This commit is contained in:
2026-05-13 16:47:31 +03:00
parent ff1820d582
commit 18b991048f
3 changed files with 9 additions and 71 deletions
+9 -2
View File
@@ -4,11 +4,18 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{
"name": "Launch Chrome",
"request": "launch",
"type": "chrome",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
},
{ {
"type": "chrome", "type": "chrome",
"request": "launch", "request": "launch",
"name": "Open starter.html", "name": "Open javaScriptTester.html",
"file": "c:\\Users\\Dream\\JavaScript\\Project_Rock,Scissors,Paper\\starter.html" "file": "c:\\Users\\Dream\\JavaScript\\6\\javaScriptTester.html"
} }
] ]
} }
-60
View File
@@ -1,60 +0,0 @@
let hum = prompt('Выберите "камень", "ножницы" или "бумага"');
let npc = Math.floor(Math.random() * 3)+1;
let stats = JSON.parse(localStorage.getItem("stats"));
if (!stats) {
stats = {
wins: 0,
looses: 0,
draws: 0
};
}
function save() {
localStorage.setItem("stats", JSON.stringify(stats));
}
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("Вы проиграли");
stats.looses++;
save()
} else if (npc === hum) {
console.log("Ничья");
alert("Ничья");
stats.draws++;
save()
} else if (npc < hum) {
console.log("Вы выиграли");
alert("Вы выиграли");
stats.wins++;
save()
} else {
console.log("Пользователь написал какую-то фигню");
}
console.log("Ваши победы - " + stats.wins + ",Ваши проигрыши - " + stats.looses + ",Ваши ничьи - " + stats.draws);
-9
View File
@@ -1,9 +0,0 @@
<!DOCTYPE html>
<head> <title>Игрульки</title></head>
<body>
<script type="text/javascript" src="main.js"></script>
<h1>Вас приветствует игра "Камень, Ножницы, Бумага"</h1>
</body>
</html>