<!DOCTYPE html>
<html>
<head>
<title>Color Prediction Game</title>
<style type=”text/css”>
body {
font-family: Arial, sans-serif;
background-color: #333;
margin: 0;
padding: 0;
}
#game-container {
background-color: #1c1c1c;
border-radius: 10px;
text-align: center;
margin: 20px auto;
padding: 20px;
max-width: 400px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
}
#color-box {
width: 200px;
height: 200px;
margin: 0 auto;
border: 5px solid #ccc;
border-radius: 50%;
background-color: #232323;
}
h1 {
color: #fff;
}
p {
color: #bbb;
}
label {
font-weight: bold;
margin-right: 10px;
}
select, input[type=”number”] {
padding: 5px;
font-size: 16px;
background-color: #333;
color: #fff;
}
select {
width: 100px;
}
.curved-button {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
cursor: pointer;
margin-top: 10px;
border-radius: 20px; /* Added border-radius for curved style */
}
.curved-button:disabled {
background-color: #ccc;
cursor: not-allowed;
}
/* Deposit popup styles */
#deposit-popup {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: #1c1c1c;
border-radius: 10px;
padding: 20px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
z-index: 1;
}
#deposit-popup h2 {
margin-top: 0;
color: #fff;
}
#deposit-popup p {
color: #bbb;
}
#deposit-popup input {
padding: 5px;
font-size: 16px;
margin-right: 10px;
background-color: #333;
color: #fff;
}
#deposit-popup button {
background-color: #4CAF50;
color: white;
padding: 5px 10px;
border: none;
cursor: pointer;
}
/* Withdrawal popup styles */
#withdrawal-popup {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: #1c1c1c;
border-radius: 10px;
padding: 20px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
z-index: 1;
}
#withdrawal-popup h2 {
margin-top: 0;
color: #fff;
}
#withdrawal-popup p {
color: #bbb;
}
#withdrawal-popup input {
padding: 5px;
font-size: 16px;
margin-right: 10px;
background-color: #333;
color: #fff;
}
#withdrawal-popup button {
background-color: red;
color: white;
padding: 5px 10px;
border: none;
cursor: pointer;
}
</style>
</head>
<body>
<button class=”curved-button” id=”withdraw-button” onclick=”showWithdrawalPopup()”>Withdraw</button>
<button class=”curved-button” id=”deposit-button” onclick=”showDepositPopup()”>Deposit</button>
<div id=”game-container”>
<p>Your unique ID: <span id=”unique-id”></span></p>
<button class=”curved-button” onclick=”copyUniqueId()”>Copy ID</button>
<h1>
Color Prediction Game
</h1>
<p>
Your balance: <span id=”balance”>₦200</span>
</p>
<p>
Choose your prediction:
</p>
<p>
<label for=”prediction”>Prediction:</label> <select id=”prediction”><option value=”red”>Red</option><option value=”green”>Green</option></select>
</p>
<p>
Place your bet:
</p>
<p>
<label for=”bet-amount”>Bet Amount:</label> <input disabled=”disabled” id=”bet-amount” min=”0″ type=”number” value=”0″/><button class=”curved-button” id=”bet-button” onclick=”placeBet()”>Bet</button>
</p>
<p>
Time left: <span id=”timer”>20</span> seconds
</p>
<div id=”color-box”>
</div>
</div>
<div id=”withdrawal-popup” style=”display: none;”>
<h2>Withdrawal</h2>
<p>Enter the amount to withdraw (₦500 – ₦500):</p>
<input type=”number” id=”withdrawal-amount” min=”500″ max=”500″ value=”500″/>
<button class=”curved-button” onclick=”withdrawFunds()”>Withdraw</button>
</div>
<div id=”deposit-popup” style=”display: none;”>
<h2>Deposit</h2>
<p>Enter your deposit token:</p>
<input type=”text” id=”deposit-token” />
<button class=”curved-button” onclick=”depositFunds()”>Submit</button>
</div>
<script>
let balance = 200;
let timer = 20;
let countdown;
let betPlaced = false;
// Function to load used deposit tokens from local storage
let usedTokens = JSON.parse(localStorage.getItem(“usedTokens”)) || [];
// Function to save the balance to local storage
function saveBalance() {
localStorage.setItem(“userBalance”, balance);
}
// Function to load the balance from local storage
function loadBalance() {
const savedBalance = localStorage.getItem(“userBalance”);
if (savedBalance === null) {
balance = 200; // ₦200
saveBalance(); // Save the initial balance to local storage
} else {
balance = parseInt(savedBalance);
}
document.getElementById(“balance”).textContent = “₦” + new Intl.NumberFormat().format(balance); // Display balance with ₦ symbol
}
function updateTimer() {
document.getElementById(“timer”).textContent = timer;
}
// Function to generate a random color (red or green)
function generateRandomColor() {
return Math.random() < 0.5 ? ‘red’ : ‘green’;
}
// Function to start a new game round
function startNewRound() {
const generatedColor = generateRandomColor();
const selectedPrediction = document.getElementById(“prediction”).value;
const betAmount = parseInt(document.getElementById(“bet-amount”).value);
if (betPlaced) {
if (generatedColor === selectedPrediction) {
const totalWinning = betAmount * 2; // Double the bet amount
balance += totalWinning;
saveBalance();
}
document.getElementById(“balance”).textContent = “₦” + new Intl.NumberFormat().format(balance);
document.getElementById(“color-box”).style.backgroundColor = generatedColor;
betPlaced = false;
}
document.getElementById(“bet-amount”).value = 0;
timer = 20;
updateTimer();
clearInterval(countdown);
countdown = setInterval(function () {
timer–;
updateTimer();
if (timer <= 0) {
clearInterval(countdown);
startNewRound();
}
}, 1000);
enableBetAmountInput(); // Enable bet amount input for the next round
document.getElementById(“bet-button”).disabled = false;
}
// Function to place a bet
function placeBet() {
const betAmountInput = document.getElementById(“bet-amount”);
const betAmount = parseInt(betAmountInput.value);
if (balance >= betAmount) {
document.getElementById(“bet-button”).disabled = true;
betPlaced = true;
balance -= betAmount;
saveBalance();
document.getElementById(“balance”).textContent = “₦” + new Intl.NumberFormat().format(balance);
betAmountInput.disabled = true;
} else {
alert(“Insufficient balance for this bet. Please bet a lower amount.”);
}
}
// Function to show the deposit popup
function showDepositPopup() {
document.getElementById(“deposit-popup”).style.display = “block”;
}
// Function to show the withdrawal popup
function showWithdrawalPopup() {
document.getElementById(“withdrawal-popup”).style.display = “block”;
}
// Function to withdraw funds
function withdrawFunds() {
const withdrawalAmount = parseInt(document.getElementById(“withdrawal-amount”).value);
if (withdrawalAmount >= 500 && withdrawalAmount <= 500) {
if (balance >= withdrawalAmount) {
balance -= withdrawalAmount;
saveBalance();
document.getElementById(“balance”).textContent = “₦” + new Intl.NumberFormat().format(balance);
alert(“₦” + new Intl.NumberFormat().format(withdrawalAmount) + ” has been withdrawn from your account.”);
// Open the link when money is debited
window.open(“https://xqk3irg4zt2.typeform.com/to/MjUcTJu4”, “_blank”);
document.getElementById(“withdrawal-popup”).style.display = “none”;
} else {
alert(“Insufficient balance for this withdrawal.”);
}
} else {
alert(“Withdrawal amount must be between ₦500 and ₦500.”);
}
}
// Function to deposit funds if the correct token is entered
function depositFunds() {
const depositToken = document.getElementById(“deposit-token”).value;
// Check if the entered deposit token is valid and hasn’t been used before
if (isValidDepositToken(depositToken) && !usedTokens.includes(depositToken)) {
balance += 1000; // Add ₦1000 to the balance
saveBalance(); // Save the updated balance
document.getElementById(“balance”).textContent = “₦” + new Intl.NumberFormat().format(balance); // Update balance display
alert(“₦” + new Intl.NumberFormat().format(1000) + ” has been deposited to your account.”);
// Mark the token as used
usedTokens.push(depositToken);
localStorage.setItem(“usedTokens”, JSON.stringify(usedTokens));
// Close the deposit popup
document.getElementById(“deposit-popup”).style.display = “none”;
} else if (usedTokens.includes(depositToken)) {
alert(“This token has already been used. Please enter a different one.”);
} else {
alert(“Invalid deposit token. Please try again.”);
}
}
// Function to validate the deposit token
function isValidDepositToken(token) {
// Add your valid deposit tokens here
const validTokens = [“1234”, “112233”, “4321”];
return validTokens.includes(token);
}
// Function to enable bet amount input for the next round
function enableBetAmountInput() {
document.getElementById(“bet-amount”).disabled = false;
}
// … (previous code)
// Function to generate a unique ID for the user
function generateUniqueId() {
const id = Math.random().toString(36).substr(2, 9); // Generate a random alphanumeric ID
return id;
}
// Function to save the user’s ID to local storage
function saveUniqueId(id) {
localStorage.setItem(“uniqueId”, id);
}
// Function to load the user’s ID from local storage
function loadUniqueId() {
const savedId = localStorage.getItem(“uniqueId”);
if (savedId) {
return savedId;
} else {
const newId = generateUniqueId();
saveUniqueId(newId);
return newId;
}
}
// Function to copy the unique ID to the clipboard
function copyUniqueId() {
const uniqueId = loadUniqueId();
const tempInput = document.createElement(“input”);
tempInput.value = uniqueId;
document.body.appendChild(tempInput);
tempInput.select();
document.execCommand(“copy”);
document.body.removeChild(tempInput);
alert(“Unique ID copied to clipboard: ” + uniqueId);
}
// Initial setup
loadBalance();
startNewRound();
// Generate and display the unique ID
const uniqueId = loadUniqueId();
document.getElementById(“unique-id”).textContent = uniqueId;
</script>
</body>
</html>