Spaces:
Running
Running
can you change it to a remake of stake mines from the stake website - Initial Deployment
Browse files- README.md +6 -4
- index.html +433 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: yellow
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: stake-mines
|
| 3 |
+
emoji: 🐳
|
| 4 |
colorFrom: yellow
|
| 5 |
+
colorTo: purple
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,433 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Stake Mines Remake</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
.cell {
|
| 11 |
+
transition: all 0.2s ease;
|
| 12 |
+
perspective: 1000px;
|
| 13 |
+
}
|
| 14 |
+
.cell-inner {
|
| 15 |
+
transition: transform 0.6s;
|
| 16 |
+
transform-style: preserve-3d;
|
| 17 |
+
}
|
| 18 |
+
.cell.flipped .cell-inner {
|
| 19 |
+
transform: rotateY(180deg);
|
| 20 |
+
}
|
| 21 |
+
.cell-front, .cell-back {
|
| 22 |
+
backface-visibility: hidden;
|
| 23 |
+
position: absolute;
|
| 24 |
+
width: 100%;
|
| 25 |
+
height: 100%;
|
| 26 |
+
top: 0;
|
| 27 |
+
left: 0;
|
| 28 |
+
}
|
| 29 |
+
.cell-back {
|
| 30 |
+
transform: rotateY(180deg);
|
| 31 |
+
}
|
| 32 |
+
.diamond {
|
| 33 |
+
background: linear-gradient(135deg, #00FFFF, #0080FF);
|
| 34 |
+
-webkit-background-clip: text;
|
| 35 |
+
background-clip: text;
|
| 36 |
+
color: transparent;
|
| 37 |
+
}
|
| 38 |
+
.bomb {
|
| 39 |
+
background: linear-gradient(135deg, #FF0000, #FF8000);
|
| 40 |
+
-webkit-background-clip: text;
|
| 41 |
+
background-clip: text;
|
| 42 |
+
color: transparent;
|
| 43 |
+
}
|
| 44 |
+
.pulse {
|
| 45 |
+
animation: pulse 2s infinite;
|
| 46 |
+
}
|
| 47 |
+
@keyframes pulse {
|
| 48 |
+
0% { transform: scale(1); }
|
| 49 |
+
50% { transform: scale(1.05); }
|
| 50 |
+
100% { transform: scale(1); }
|
| 51 |
+
}
|
| 52 |
+
.shake {
|
| 53 |
+
animation: shake 0.5s;
|
| 54 |
+
}
|
| 55 |
+
@keyframes shake {
|
| 56 |
+
0%, 100% { transform: translateX(0); }
|
| 57 |
+
10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
|
| 58 |
+
20%, 40%, 60%, 80% { transform: translateX(5px); }
|
| 59 |
+
}
|
| 60 |
+
</style>
|
| 61 |
+
</head>
|
| 62 |
+
<body class="bg-gray-900 text-white min-h-screen">
|
| 63 |
+
<div class="container mx-auto px-4 py-8">
|
| 64 |
+
<div class="max-w-4xl mx-auto">
|
| 65 |
+
<!-- Header -->
|
| 66 |
+
<header class="flex flex-col md:flex-row justify-between items-center mb-8">
|
| 67 |
+
<div class="flex items-center mb-4 md:mb-0">
|
| 68 |
+
<i class="fas fa-gem text-blue-400 text-3xl mr-2"></i>
|
| 69 |
+
<h1 class="text-2xl font-bold bg-gradient-to-r from-blue-400 to-purple-500 bg-clip-text text-transparent">Stake Mines</h1>
|
| 70 |
+
</div>
|
| 71 |
+
<div class="flex items-center space-x-4">
|
| 72 |
+
<div class="bg-gray-800 rounded-lg px-4 py-2">
|
| 73 |
+
<span class="text-gray-400">Balance:</span>
|
| 74 |
+
<span class="font-bold ml-2">$<span id="balance">1000.00</span></span>
|
| 75 |
+
</div>
|
| 76 |
+
<button id="cashout-btn" class="bg-gradient-to-r from-green-500 to-teal-500 hover:from-green-600 hover:to-teal-600 text-white font-bold py-2 px-4 rounded-lg transition disabled:opacity-50" disabled>
|
| 77 |
+
Cashout
|
| 78 |
+
</button>
|
| 79 |
+
</div>
|
| 80 |
+
</header>
|
| 81 |
+
|
| 82 |
+
<!-- Game Controls -->
|
| 83 |
+
<div class="bg-gray-800 rounded-xl p-6 mb-8">
|
| 84 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
| 85 |
+
<div>
|
| 86 |
+
<label class="block text-gray-400 mb-2">Bet Amount</label>
|
| 87 |
+
<div class="flex">
|
| 88 |
+
<button class="bg-gray-700 px-3 py-2 rounded-l-lg hover:bg-gray-600" onclick="adjustBet(-10)">-</button>
|
| 89 |
+
<input type="number" id="bet-amount" value="10.00" min="1" step="0.01" class="bg-gray-700 text-center w-full py-2 px-3 focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 90 |
+
<button class="bg-gray-700 px-3 py-2 rounded-r-lg hover:bg-gray-600" onclick="adjustBet(10)">+</button>
|
| 91 |
+
</div>
|
| 92 |
+
</div>
|
| 93 |
+
<div>
|
| 94 |
+
<label class="block text-gray-400 mb-2">Mines</label>
|
| 95 |
+
<div class="flex">
|
| 96 |
+
<button class="bg-gray-700 px-3 py-2 rounded-l-lg hover:bg-gray-600" onclick="adjustMines(-1)">-</button>
|
| 97 |
+
<input type="number" id="mines-count" value="3" min="1" max="24" class="bg-gray-700 text-center w-full py-2 px-3 focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 98 |
+
<button class="bg-gray-700 px-3 py-2 rounded-r-lg hover:bg-gray-600" onclick="adjustMines(1)">+</button>
|
| 99 |
+
</div>
|
| 100 |
+
</div>
|
| 101 |
+
<div class="flex items-end">
|
| 102 |
+
<button id="start-btn" class="w-full bg-gradient-to-r from-blue-500 to-purple-600 hover:from-blue-600 hover:to-purple-700 text-white font-bold py-3 px-4 rounded-lg transition pulse">
|
| 103 |
+
Start Game
|
| 104 |
+
</button>
|
| 105 |
+
</div>
|
| 106 |
+
</div>
|
| 107 |
+
</div>
|
| 108 |
+
|
| 109 |
+
<!-- Game Board -->
|
| 110 |
+
<div class="bg-gray-800 rounded-xl p-6 mb-8">
|
| 111 |
+
<div class="flex justify-between items-center mb-4">
|
| 112 |
+
<div class="text-gray-400">
|
| 113 |
+
Multiplier: <span id="multiplier" class="font-bold text-green-400">1.00x</span>
|
| 114 |
+
</div>
|
| 115 |
+
<div class="text-gray-400">
|
| 116 |
+
Mines: <span id="current-mines" class="font-bold text-red-400">0</span>/<span id="total-mines">3</span>
|
| 117 |
+
</div>
|
| 118 |
+
</div>
|
| 119 |
+
|
| 120 |
+
<div id="game-board" class="grid grid-cols-5 md:grid-cols-8 gap-3">
|
| 121 |
+
<!-- Cells will be generated here -->
|
| 122 |
+
<div class="text-center text-gray-500 py-8">Start a new game</div>
|
| 123 |
+
</div>
|
| 124 |
+
</div>
|
| 125 |
+
|
| 126 |
+
<!-- Stats -->
|
| 127 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-8">
|
| 128 |
+
<div class="bg-gray-800 rounded-xl p-4">
|
| 129 |
+
<div class="text-gray-400">Last Win</div>
|
| 130 |
+
<div class="text-2xl font-bold" id="last-win">$0.00</div>
|
| 131 |
+
</div>
|
| 132 |
+
<div class="bg-gray-800 rounded-xl p-4">
|
| 133 |
+
<div class="text-gray-400">Best Win</div>
|
| 134 |
+
<div class="text-2xl font-bold" id="best-win">$0.00</div>
|
| 135 |
+
</div>
|
| 136 |
+
<div class="bg-gray-800 rounded-xl p-4">
|
| 137 |
+
<div class="text-gray-400">Games Played</div>
|
| 138 |
+
<div class="text-2xl font-bold" id="games-played">0</div>
|
| 139 |
+
</div>
|
| 140 |
+
</div>
|
| 141 |
+
|
| 142 |
+
<!-- History -->
|
| 143 |
+
<div class="bg-gray-800 rounded-xl p-6">
|
| 144 |
+
<h2 class="text-xl font-bold mb-4">Recent Games</h2>
|
| 145 |
+
<div id="history" class="flex space-x-2 overflow-x-auto pb-2">
|
| 146 |
+
<div class="text-gray-500">No games played yet</div>
|
| 147 |
+
</div>
|
| 148 |
+
</div>
|
| 149 |
+
</div>
|
| 150 |
+
</div>
|
| 151 |
+
|
| 152 |
+
<script>
|
| 153 |
+
// Game state
|
| 154 |
+
let gameState = {
|
| 155 |
+
balance: 1000.00,
|
| 156 |
+
betAmount: 10.00,
|
| 157 |
+
minesCount: 3,
|
| 158 |
+
gameActive: false,
|
| 159 |
+
multiplier: 1.00,
|
| 160 |
+
multiplierIncrement: 0.25,
|
| 161 |
+
openedCells: 0,
|
| 162 |
+
totalCells: 25,
|
| 163 |
+
mines: [],
|
| 164 |
+
revealed: [],
|
| 165 |
+
lastWin: 0.00,
|
| 166 |
+
bestWin: 0.00,
|
| 167 |
+
gamesPlayed: 0,
|
| 168 |
+
history: []
|
| 169 |
+
};
|
| 170 |
+
|
| 171 |
+
// DOM elements
|
| 172 |
+
const balanceEl = document.getElementById('balance');
|
| 173 |
+
const betAmountEl = document.getElementById('bet-amount');
|
| 174 |
+
const minesCountEl = document.getElementById('mines-count');
|
| 175 |
+
const startBtn = document.getElementById('start-btn');
|
| 176 |
+
const cashoutBtn = document.getElementById('cashout-btn');
|
| 177 |
+
const gameBoardEl = document.getElementById('game-board');
|
| 178 |
+
const multiplierEl = document.getElementById('multiplier');
|
| 179 |
+
const currentMinesEl = document.getElementById('current-mines');
|
| 180 |
+
const totalMinesEl = document.getElementById('total-mines');
|
| 181 |
+
const lastWinEl = document.getElementById('last-win');
|
| 182 |
+
const bestWinEl = document.getElementById('best-win');
|
| 183 |
+
const gamesPlayedEl = document.getElementById('games-played');
|
| 184 |
+
const historyEl = document.getElementById('history');
|
| 185 |
+
|
| 186 |
+
// Initialize
|
| 187 |
+
function init() {
|
| 188 |
+
updateUI();
|
| 189 |
+
|
| 190 |
+
// Event listeners
|
| 191 |
+
betAmountEl.addEventListener('change', (e) => {
|
| 192 |
+
gameState.betAmount = parseFloat(e.target.value) || 1.00;
|
| 193 |
+
updateUI();
|
| 194 |
+
});
|
| 195 |
+
|
| 196 |
+
minesCountEl.addEventListener('change', (e) => {
|
| 197 |
+
gameState.minesCount = parseInt(e.target.value) || 1;
|
| 198 |
+
if (gameState.minesCount > 24) gameState.minesCount = 24;
|
| 199 |
+
if (gameState.minesCount < 1) gameState.minesCount = 1;
|
| 200 |
+
minesCountEl.value = gameState.minesCount;
|
| 201 |
+
updateUI();
|
| 202 |
+
});
|
| 203 |
+
|
| 204 |
+
startBtn.addEventListener('click', startGame);
|
| 205 |
+
cashoutBtn.addEventListener('click', cashout);
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
// Adjust bet amount
|
| 209 |
+
function adjustBet(amount) {
|
| 210 |
+
gameState.betAmount = Math.max(1.00, gameState.betAmount + amount);
|
| 211 |
+
betAmountEl.value = gameState.betAmount.toFixed(2);
|
| 212 |
+
updateUI();
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
// Adjust mines count
|
| 216 |
+
function adjustMines(amount) {
|
| 217 |
+
gameState.minesCount = Math.max(1, Math.min(24, gameState.minesCount + amount));
|
| 218 |
+
minesCountEl.value = gameState.minesCount;
|
| 219 |
+
updateUI();
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
// Update UI
|
| 223 |
+
function updateUI() {
|
| 224 |
+
balanceEl.textContent = gameState.balance.toFixed(2);
|
| 225 |
+
betAmountEl.value = gameState.betAmount.toFixed(2);
|
| 226 |
+
minesCountEl.value = gameState.minesCount;
|
| 227 |
+
totalMinesEl.textContent = gameState.minesCount;
|
| 228 |
+
|
| 229 |
+
if (gameState.gameActive) {
|
| 230 |
+
startBtn.disabled = true;
|
| 231 |
+
startBtn.textContent = 'Game in Progress';
|
| 232 |
+
cashoutBtn.disabled = false;
|
| 233 |
+
} else {
|
| 234 |
+
startBtn.disabled = gameState.balance < gameState.betAmount;
|
| 235 |
+
startBtn.textContent = 'Start Game';
|
| 236 |
+
cashoutBtn.disabled = true;
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
lastWinEl.textContent = '$' + gameState.lastWin.toFixed(2);
|
| 240 |
+
bestWinEl.textContent = '$' + gameState.bestWin.toFixed(2);
|
| 241 |
+
gamesPlayedEl.textContent = gameState.gamesPlayed;
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
// Start new game
|
| 245 |
+
function startGame() {
|
| 246 |
+
if (gameState.gameActive || gameState.balance < gameState.betAmount) return;
|
| 247 |
+
|
| 248 |
+
// Deduct bet from balance
|
| 249 |
+
gameState.balance -= gameState.betAmount;
|
| 250 |
+
gameState.gameActive = true;
|
| 251 |
+
gameState.multiplier = 1.00;
|
| 252 |
+
gameState.openedCells = 0;
|
| 253 |
+
gameState.revealed = Array(25).fill(false);
|
| 254 |
+
|
| 255 |
+
// Generate mines
|
| 256 |
+
gameState.mines = [];
|
| 257 |
+
while (gameState.mines.length < gameState.minesCount) {
|
| 258 |
+
const randomIndex = Math.floor(Math.random() * 25);
|
| 259 |
+
if (!gameState.mines.includes(randomIndex)) {
|
| 260 |
+
gameState.mines.push(randomIndex);
|
| 261 |
+
}
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
// Create game board
|
| 265 |
+
gameBoardEl.innerHTML = '';
|
| 266 |
+
for (let i = 0; i < 25; i++) {
|
| 267 |
+
const cell = document.createElement('div');
|
| 268 |
+
cell.className = 'cell aspect-square bg-gray-700 rounded-lg cursor-pointer relative';
|
| 269 |
+
cell.dataset.index = i;
|
| 270 |
+
|
| 271 |
+
const cellInner = document.createElement('div');
|
| 272 |
+
cellInner.className = 'cell-inner w-full h-full';
|
| 273 |
+
|
| 274 |
+
const cellFront = document.createElement('div');
|
| 275 |
+
cellFront.className = 'cell-front flex items-center justify-center text-2xl font-bold';
|
| 276 |
+
cellFront.innerHTML = '<i class="fas fa-question text-gray-400"></i>';
|
| 277 |
+
|
| 278 |
+
const cellBack = document.createElement('div');
|
| 279 |
+
cellBack.className = 'cell-back flex items-center justify-center text-2xl font-bold';
|
| 280 |
+
|
| 281 |
+
cellInner.appendChild(cellFront);
|
| 282 |
+
cellInner.appendChild(cellBack);
|
| 283 |
+
cell.appendChild(cellInner);
|
| 284 |
+
|
| 285 |
+
cell.addEventListener('click', () => revealCell(i, cell));
|
| 286 |
+
gameBoardEl.appendChild(cell);
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
updateUI();
|
| 290 |
+
multiplierEl.textContent = gameState.multiplier.toFixed(2) + 'x';
|
| 291 |
+
currentMinesEl.textContent = '0';
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
// Reveal cell
|
| 295 |
+
function revealCell(index, cellElement) {
|
| 296 |
+
if (!gameState.gameActive || gameState.revealed[index]) return;
|
| 297 |
+
|
| 298 |
+
gameState.revealed[index] = true;
|
| 299 |
+
gameState.openedCells++;
|
| 300 |
+
|
| 301 |
+
// Check if it's a mine
|
| 302 |
+
if (gameState.mines.includes(index)) {
|
| 303 |
+
cellElement.classList.add('flipped');
|
| 304 |
+
const back = cellElement.querySelector('.cell-back');
|
| 305 |
+
back.innerHTML = '<i class="fas fa-bomb bomb text-3xl"></i>';
|
| 306 |
+
back.classList.add('bg-red-900', 'bg-opacity-50');
|
| 307 |
+
|
| 308 |
+
// Reveal all mines
|
| 309 |
+
setTimeout(() => {
|
| 310 |
+
gameState.mines.forEach(mineIndex => {
|
| 311 |
+
if (mineIndex !== index) {
|
| 312 |
+
const mineCell = gameBoardEl.children[mineIndex];
|
| 313 |
+
mineCell.classList.add('flipped');
|
| 314 |
+
const mineBack = mineCell.querySelector('.cell-back');
|
| 315 |
+
mineBack.innerHTML = '<i class="fas fa-bomb bomb text-3xl"></i>';
|
| 316 |
+
mineBack.classList.add('bg-red-900', 'bg-opacity-30');
|
| 317 |
+
}
|
| 318 |
+
});
|
| 319 |
+
|
| 320 |
+
// Game over
|
| 321 |
+
endGame(false);
|
| 322 |
+
}, 500);
|
| 323 |
+
|
| 324 |
+
// Shake animation
|
| 325 |
+
cellElement.classList.add('shake');
|
| 326 |
+
setTimeout(() => {
|
| 327 |
+
cellElement.classList.remove('shake');
|
| 328 |
+
}, 500);
|
| 329 |
+
|
| 330 |
+
return;
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
// It's a diamond
|
| 334 |
+
cellElement.classList.add('flipped');
|
| 335 |
+
const back = cellElement.querySelector('.cell-back');
|
| 336 |
+
back.innerHTML = '<i class="fas fa-gem diamond text-3xl"></i>';
|
| 337 |
+
back.classList.add('bg-blue-900', 'bg-opacity-30');
|
| 338 |
+
|
| 339 |
+
// Update multiplier
|
| 340 |
+
const safeCells = 25 - gameState.minesCount;
|
| 341 |
+
const multiplierStep = 1 / safeCells;
|
| 342 |
+
gameState.multiplier += multiplierStep * 5;
|
| 343 |
+
|
| 344 |
+
multiplierEl.textContent = gameState.multiplier.toFixed(2) + 'x';
|
| 345 |
+
currentMinesEl.textContent = gameState.openedCells;
|
| 346 |
+
|
| 347 |
+
// Check if all safe cells are revealed
|
| 348 |
+
if (gameState.openedCells === (25 - gameState.minesCount)) {
|
| 349 |
+
endGame(true);
|
| 350 |
+
}
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
// Cash out
|
| 354 |
+
function cashout() {
|
| 355 |
+
if (!gameState.gameActive) return;
|
| 356 |
+
|
| 357 |
+
const winAmount = gameState.betAmount * gameState.multiplier;
|
| 358 |
+
gameState.balance += winAmount;
|
| 359 |
+
gameState.lastWin = winAmount;
|
| 360 |
+
if (winAmount > gameState.bestWin) {
|
| 361 |
+
gameState.bestWin = winAmount;
|
| 362 |
+
}
|
| 363 |
+
gameState.gamesPlayed++;
|
| 364 |
+
|
| 365 |
+
// Add to history
|
| 366 |
+
addToHistory(true, winAmount);
|
| 367 |
+
|
| 368 |
+
// End game
|
| 369 |
+
endGame(true, true);
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
// End game
|
| 373 |
+
function endGame(win, cashout = false) {
|
| 374 |
+
gameState.gameActive = false;
|
| 375 |
+
|
| 376 |
+
if (!win && !cashout) {
|
| 377 |
+
gameState.lastWin = 0;
|
| 378 |
+
gameState.gamesPlayed++;
|
| 379 |
+
addToHistory(false, 0);
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
updateUI();
|
| 383 |
+
|
| 384 |
+
// Show game result
|
| 385 |
+
if (win && !cashout) {
|
| 386 |
+
const winAmount = gameState.betAmount * gameState.multiplier;
|
| 387 |
+
gameState.balance += winAmount;
|
| 388 |
+
gameState.lastWin = winAmount;
|
| 389 |
+
if (winAmount > gameState.bestWin) {
|
| 390 |
+
gameState.bestWin = winAmount;
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
addToHistory(true, winAmount);
|
| 394 |
+
|
| 395 |
+
setTimeout(() => {
|
| 396 |
+
alert(`Congratulations! You won $${winAmount.toFixed(2)}!`);
|
| 397 |
+
}, 300);
|
| 398 |
+
}
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
// Add to history
|
| 402 |
+
function addToHistory(win, amount) {
|
| 403 |
+
const historyItem = document.createElement('div');
|
| 404 |
+
historyItem.className = `flex-shrink-0 rounded-lg px-3 py-2 text-center ${win ? 'bg-green-900 bg-opacity-50' : 'bg-red-900 bg-opacity-50'}`;
|
| 405 |
+
historyItem.innerHTML = win
|
| 406 |
+
? `<i class="fas fa-gem diamond mr-1"></i> $${amount.toFixed(2)}`
|
| 407 |
+
: '<i class="fas fa-bomb bomb mr-1"></i> $0.00';
|
| 408 |
+
|
| 409 |
+
// Prepend to history
|
| 410 |
+
if (historyEl.firstChild && historyEl.firstChild.textContent === 'No games played yet') {
|
| 411 |
+
historyEl.innerHTML = '';
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
historyEl.prepend(historyItem);
|
| 415 |
+
|
| 416 |
+
// Keep only last 10 items
|
| 417 |
+
if (historyEl.children.length > 10) {
|
| 418 |
+
historyEl.removeChild(historyEl.lastChild);
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
+
// Add to game state history
|
| 422 |
+
gameState.history.unshift({
|
| 423 |
+
win,
|
| 424 |
+
amount,
|
| 425 |
+
timestamp: new Date()
|
| 426 |
+
});
|
| 427 |
+
}
|
| 428 |
+
|
| 429 |
+
// Initialize the game
|
| 430 |
+
init();
|
| 431 |
+
</script>
|
| 432 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=tyleristrying/stake-mines" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 433 |
+
</html>
|