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;
|
||||
margin: 0;
|
||||
background-color: #fff3b0;
|
||||
|
||||
}
|
||||
.game-button {
|
||||
width: 100px;
|
||||
|
@ -36,6 +35,12 @@
|
|||
.yellow {
|
||||
background-color: #b36609;
|
||||
}
|
||||
.counter {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
font-size: 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<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 personally didn't really know that HTML has this many functions.</h1>
|
||||
</p>
|
||||
<div class="counter">Round: 0</div>
|
||||
<script>
|
||||
const buttonColors = ['green', 'red', 'blue', 'yellow'];
|
||||
const gameSequence = [];
|
||||
|
@ -93,6 +99,8 @@
|
|||
|
||||
if (playerSequence.length === gameSequence.length) {
|
||||
if (JSON.stringify(playerSequence) === JSON.stringify(gameSequence)) {
|
||||
round++;
|
||||
updateRoundCounter();
|
||||
await sleep(500);
|
||||
playRound();
|
||||
} else {
|
||||
|
@ -114,9 +122,15 @@
|
|||
gameSequence.length = 0;
|
||||
playerSequence.length = 0;
|
||||
round = 0;
|
||||
updateRoundCounter();
|
||||
playRound();
|
||||
}
|
||||
|
||||
function updateRoundCounter() {
|
||||
const counterElement = document.querySelector('.counter');
|
||||
counterElement.textContent = `Round: ${round}`;
|
||||
}
|
||||
|
||||
playRound(); // Start the game
|
||||
</script>
|
||||
</body>
|
||||
|
|
Loading…
Add table
Reference in a new issue