diff --git a/Project/img/бумага.png b/Project/img/бумага.png new file mode 100644 index 0000000..5209464 Binary files /dev/null and b/Project/img/бумага.png differ diff --git a/Project/img/знак больше.png b/Project/img/знак больше.png new file mode 100644 index 0000000..60f5ec1 Binary files /dev/null and b/Project/img/знак больше.png differ diff --git a/Project/img/знак меньше.png b/Project/img/знак меньше.png new file mode 100644 index 0000000..106b982 Binary files /dev/null and b/Project/img/знак меньше.png differ diff --git a/Project/img/знак равно.png b/Project/img/знак равно.png new file mode 100644 index 0000000..01bc2cf Binary files /dev/null and b/Project/img/знак равно.png differ diff --git a/Project/img/камушек.png b/Project/img/камушек.png new file mode 100644 index 0000000..df128c6 Binary files /dev/null and b/Project/img/камушек.png differ diff --git a/Project/img/макет сайта.png b/Project/img/макет сайта.png new file mode 100644 index 0000000..1a326e8 Binary files /dev/null and b/Project/img/макет сайта.png differ diff --git a/Project/img/ножницы.png b/Project/img/ножницы.png new file mode 100644 index 0000000..080add2 Binary files /dev/null and b/Project/img/ножницы.png differ diff --git a/Project/index.html b/Project/index.html index 5948560..a318f42 100644 --- a/Project/index.html +++ b/Project/index.html @@ -1,9 +1,27 @@ - Игрульки + + Игрульки + +

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

+ +
+
+ +
+ +
+ +
+ +
+ +
+
+ \ No newline at end of file diff --git a/Project/main.js b/Project/main.js index 8970ed3..466ef16 100644 --- a/Project/main.js +++ b/Project/main.js @@ -1,6 +1,3 @@ -let hum = prompt('Выберите "камень", "ножницы" или "бумага"'); -let npc = Math.floor(Math.random() * 3) + 1; - let stats = JSON.parse(localStorage.getItem("stats")); if (!stats) { @@ -22,40 +19,36 @@ const Stone = { num: 3, Name: 'камень' }; const Scissors = { num: 2, Name: 'ножницы' }; const Paper = { num: 1, Name: 'бумага' }; +function game(hum) { -if (hum === Stone.Name) { - hum = Stone.num; -} else if (hum === Scissors.Name) { - hum = Scissors.num; -} else if (hum === Paper.Name) { - hum = Paper.num; -}; + let npc = Math.floor(Math.random() * 3) + 1; + 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("Пользователь написал какую-то фигню"); + } -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("wins-" + stats.wins + ",looses-" + stats.looses + ",draws-" + stats.draws); -alert("Ваши победы - " + stats.wins + ",Ваши проигрыши - " + stats.looses + ",Ваши ничьи - " + stats.draws); \ No newline at end of file +console.log("wins-" + stats.wins + ",looses-" + stats.looses + ",draws-" + stats.draws); \ No newline at end of file diff --git a/Project/style.css b/Project/style.css new file mode 100644 index 0000000..62ac176 --- /dev/null +++ b/Project/style.css @@ -0,0 +1,19 @@ +.game-board { + display: flex; + justify-content: center; + gap: 20px; + flex-wrap: wrap; +} + + +.card-img { + width: 200px; + height: 200px; + overflow: hidden; +} + +.card-img img { + width: 100%; + height: 100%; + object-fit: cover; +}