Update RedditlikeMemo.HTML
This commit is contained in:
parent
cf3fb955b6
commit
cf1dcfa825
1 changed files with 15 additions and 1 deletions
|
@ -13,7 +13,6 @@
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
background-color: #fff3b0;
|
background-color: #fff3b0;
|
||||||
|
|
||||||
}
|
}
|
||||||
.game-button {
|
.game-button {
|
||||||
width: 100px;
|
width: 100px;
|
||||||
|
@ -36,6 +35,12 @@
|
||||||
.yellow {
|
.yellow {
|
||||||
background-color: #b36609;
|
background-color: #b36609;
|
||||||
}
|
}
|
||||||
|
.counter {
|
||||||
|
position: absolute;
|
||||||
|
top: 10px;
|
||||||
|
right: 10px;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -49,6 +54,7 @@
|
||||||
<h1>I am going to be frankly pretty honest, ChatGPT helped me a lot with this one.</h1>
|
<h1>I am going to be frankly pretty honest, ChatGPT helped me a lot with this one.</h1>
|
||||||
<h1>I personally didn't really know that HTML has this many functions.</h1>
|
<h1>I personally didn't really know that HTML has this many functions.</h1>
|
||||||
</p>
|
</p>
|
||||||
|
<div class="counter">Round: 0</div>
|
||||||
<script>
|
<script>
|
||||||
const buttonColors = ['green', 'red', 'blue', 'yellow'];
|
const buttonColors = ['green', 'red', 'blue', 'yellow'];
|
||||||
const gameSequence = [];
|
const gameSequence = [];
|
||||||
|
@ -93,6 +99,8 @@
|
||||||
|
|
||||||
if (playerSequence.length === gameSequence.length) {
|
if (playerSequence.length === gameSequence.length) {
|
||||||
if (JSON.stringify(playerSequence) === JSON.stringify(gameSequence)) {
|
if (JSON.stringify(playerSequence) === JSON.stringify(gameSequence)) {
|
||||||
|
round++;
|
||||||
|
updateRoundCounter();
|
||||||
await sleep(500);
|
await sleep(500);
|
||||||
playRound();
|
playRound();
|
||||||
} else {
|
} else {
|
||||||
|
@ -114,9 +122,15 @@
|
||||||
gameSequence.length = 0;
|
gameSequence.length = 0;
|
||||||
playerSequence.length = 0;
|
playerSequence.length = 0;
|
||||||
round = 0;
|
round = 0;
|
||||||
|
updateRoundCounter();
|
||||||
playRound();
|
playRound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateRoundCounter() {
|
||||||
|
const counterElement = document.querySelector('.counter');
|
||||||
|
counterElement.textContent = `Round: ${round}`;
|
||||||
|
}
|
||||||
|
|
||||||
playRound(); // Start the game
|
playRound(); // Start the game
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Add table
Reference in a new issue