<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Aviator Crash Casino</title> <style> body { font-family: Arial, sans-serif; text-align: center; background-color: #f0f0f0; margin: 0; padding: 0; } #game-container { margin-top: 50px; } canvas { border: 2px solid #000; display: block; margin: 0 auto; } #score { margin-top: 20px; font-weight: bold; font-size: 24px; color: #333; } #balance { margin-top: 20px; font-weight: bold; font-size: 24px; color: #333; } #controls { margin-top: 20px; } #history { margin-top: 20px; font-size: 16px; } #multiplier { font-size: 18px; } </style> </head> <body> <h1>Aviator Crash Casino</h1> <div id="game-container"> <canvas id="gameCanvas" width="800" height="400"></canvas> <div> <label for="betAmount">Enter Bet Amount:</label> <input type="number" id="betAmount" min="1" step="1"> </div> <div id="balance">Balance: $1000.00</div> <div id="score">Cash Out Amount: $0.00</div> <div id="controls"> <button id="placeBetButton" onclick="placeBet()">Place Bet</button> <button id="cashoutButton" onclick="cashOut()" disabled>Cash Out</button> </div> <div id="history"></div> <div id="hashResult" style="display:none;"></div> <!-- Hidden div to display hash result --> </div> <script> let balance = 1000.00; const canvas = document.getElementById('gameCanvas'); const ctx = canvas.getContext('2d'); let cashOutAmount = 0; let betAmount = 0; let isPlaying = false; let animationFrameId; let crashMultiplier = 1; let roundMultiplierHistory = []; let multiplierIncrement = 0.01; // Increment amount for multiplier animation let animationSpeed = 40; // Animation speed in milliseconds let targetMultiplier = 1.00; // Multiplicador objetivo generado let hashGenerated = true; // Estado del hash generado function placeBet() { if (!isPlaying) { betAmount = parseInt(document.getElementById('betAmount').value); if (betAmount > 0 && betAmount <= balance) { balance -= betAmount; document.getElementById('balance').innerText = `Balance: $${balance.toFixed(2)}`; isPlaying = true; document.getElementById('betAmount').disabled = true; document.getElementById('placeBetButton').disabled = true; document.getElementById('cashoutButton').disabled = false; animate(); } else { alert("Invalid bet amount or insufficient balance."); } } } function cashOut() { if (isPlaying) { isPlaying = false; document.getElementById('betAmount').disabled = false; document.getElementById('placeBetButton').disabled = false; document.getElementById('cashoutButton').disabled = true; balance += cashOutAmount; roundMultiplierHistory.push(crashMultiplier.toFixed(2)); // Add final multiplier to history updateMultiplierHistory(); document.getElementById('balance').innerText = `Balance: $${balance.toFixed(2)}`; alert(`Congratulations! You cashed out $${cashOutAmount.toFixed(2)}`); cashOutAmount = 0; betAmount = 0; targetMultiplier = 1.00; // Reiniciar el multiplicador objetivo hashGenerated = false; // Reiniciar el estado del hash generado } } function animate() { ctx.clearRect(0, 0, canvas.width, canvas.height); drawGraph(); cashOutAmount = betAmount * crashMultiplier; document.getElementById('score').innerText = `Cash Out Amount: $${cashOutAmount.toFixed(2)}`; // Verificar si se ha generado el hash y el multiplicador animado alcanza el objetivo if (hashGenerated && crashMultiplier >= targetMultiplier) { gameOver(); return; } if (crashMultiplier <= 0) { gameOver(); } else { animationFrameId = requestAnimationFrame(animate); } } function drawGraph() { ctx.strokeStyle = 'blue'; ctx.lineWidth = 2; ctx.beginPath(); ctx.moveTo(0, canvas.height); for (let i = 0; i < canvas.width; i++) { let y = Math.sin(i / 20) * 50 + 200; // Sinusoidal function ctx.lineTo(i, y); } ctx.stroke(); ctx.strokeStyle = 'red'; ctx.lineWidth = 1; ctx.beginPath(); let multiplierY = canvas.height - (canvas.height * crashMultiplier / 10); ctx.moveTo(0, multiplierY); ctx.lineTo(canvas.width, multiplierY); ctx.stroke(); ctx.font = "18px Arial"; ctx.fillStyle = "black"; ctx.fillText(`Multiplier: ${crashMultiplier.toFixed(2)}x`, canvas.width - 150, 30); if (Math.random() < 0.05) { if (crashMultiplier > 500.00) { crashMultiplier += 2.5; // Increase crash multiplier even faster if multiplier > 10.00x } else if (crashMultiplier > 100.00) { crashMultiplier += 1.5; // Increase crash multiplier even faster if multiplier > 10.00x } else if (crashMultiplier > 30.00) { crashMultiplier += 0.6; // Increase crash multiplier even faster if multiplier > 10.00x } else if (crashMultiplier > 10.00) { crashMultiplier += 0.1; // Increase crash multiplier even faster if multiplier > 10.00x } else if (crashMultiplier > 6.00) { crashMultiplier += 0.02; // Increase crash multiplier even faster if multiplier > 6.00x } else if (crashMultiplier > 2.00) { crashMultiplier += 0.015; // Increase crash multiplier faster if multiplier > 2.00x } else { crashMultiplier += multiplierIncrement; // Default increment } } } function gameOver() { if (crashMultiplier <= 0) { alert(`Game Over! You lost your bet of $${betAmount}`); } else { alert(`Congratulations! You reached the target multiplier of ${targetMultiplier.toFixed(2)}x. You cashed out $${cashOutAmount.toFixed(2)}`); } document.getElementById('betAmount').disabled = false; document.getElementById('placeBetButton').disabled = false; document.getElementById('cashoutButton').disabled = true; betAmount = 0; crashMultiplier = 1; roundMultiplierHistory = []; updateMultiplierHistory(); cashOutAmount = 0; targetMultiplier = 1.00; // Reiniciar el multiplicador objetivo hashGenerated = false; // Reiniciar el estado del hash generado } function updateMultiplierHistory() { document.getElementById('history').innerHTML = `Last Round Multiplier: ${roundMultiplierHistory[roundMultiplierHistory.length - 1]}`; } // Función para generar el hash y calcular el multiplicador objetivo function generateRandomHash() { var multiplier = generateWeightedMultiplier(); var multiplierString = multiplier.toFixed(2); var hash = generateSHA512Hash(multiplierString); document.getElementById('hashResult').innerText = 'Multiplicador: ' + multiplierString + 'x - Hash: ' + hash; targetMultiplier = multiplier; // Establecer el multiplicador objetivo hashGenerated = true; // Marcar que el hash ha sido generado } function generateWeightedMultiplier() { var random = Math.random(); var ranges = [ { min: 0, max: 0.75, multiplier: generateRandomInRange(1, 1.99) }, { min: 0.78, max: 0.91, multiplier: generateRandomInRange(2, 4) }, { min: 0.91, max: 0.98, multiplier: generateRandomInRange(4.01, 8) }, { min: 0.98, max: 0.99, multiplier: generateRandomInRange(8.01, 15) }, { min: 0.995, max: 1, multiplier: generateRandomInRange(15.01, 30) }, { min: 0.9999, max: 1, multiplier: generateRandomInRange(30.01, 100) }, { min: 0.99995, max: 1, multiplier: generateRandomInRange(100, 300) } ]; for (var i = 0; i < ranges.length; i++) { if (random >= ranges[i].min && random <= ranges[i].max) { return ranges[i].multiplier; } } return 1.00; } function generateRandomInRange(min, max) { return Math.random() * (max - min) + min; } function generateSHA512Hash(input) { var hash = ''; for (var i = 0; i < input.length; i++) { hash += input.charCodeAt(i) % 16; } return hash; } </script> </body> </html>
Write, Run & Share HTML code online using OneCompiler's HTML online Code editor for free. It's one of the robust, feature-rich online Code editor for HTML language, running on the latest version HTML5. Getting started with the OneCompiler's HTML compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as HTML
. You can also specify the stylesheet information in styles.css
tab and scripts information in scripts.js
tab and start coding.
HTML(Hyper Text Markup language) is the standard markup language for Web pages, was created by Berners-Lee in the year 1991. Almost every web page over internet might be using HTML.
<!DOCTYPE html>
<html>
and ends with </html>
<h1>
to <h6>
where <h1>
is the highest important heading and <h6>
is the least important sub-heading.<p>..</p>
tag.<a>
tag.
<a href="https://onecompiler.com/html">HTML online compiler</a>
<img>
tag, where src
attribute consists of image name.<button>..</button>
tag<ul>
for unordered/bullet list and <ol>
for ordered/number list, and the list items are defined in <li>
.<a href="https://onecompiler.com/html">HTML online compiler</a>
CSS(cascading style sheets) describes how HTML elements will look on the web page like color, font-style, font-size, background color etc.
Below is a sample style sheet which displays heading in green and in Candara font with padding space of 25px.
body{
padding: 25px;
}
.title {
color: #228B22;
font-family: Candara;
}
<table>
tag.<tr>
tag<th>
tag<td>
tag<caption>
tag<script>
is the tag used to write scripts in HTML<script src="script.js"></script>