caelum0x 2b68bde5d5 Predikt: full Polymarket-style prediction market — web + mobile + on-chain + bots
Working tree is now the canonical repo. Off-chain play-money + trustless on-chain
(FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution,
mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 23:29:50 +03:00

345 lines
12 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Rock Paper Scissors Poker Calculator</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
background-color: #f0f0f0;
color: #333;
}
h1,
h2,
h3 {
color: #2c3e50;
}
.container {
background-color: #ffffff;
border-radius: 8px;
padding: 20px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.input-group {
display: flex;
align-items: center;
margin-bottom: 15px;
}
label {
margin-right: 10px;
font-weight: bold;
}
input[type="number"] {
width: 60px;
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 16px;
}
.button-group {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-bottom: 15px;
}
.button-group button {
flex-grow: 1;
min-width: 60px;
padding: 12px;
font-size: 16px;
border: none;
background-color: #3498db;
color: white;
cursor: pointer;
border-radius: 4px;
transition: background-color 0.3s;
}
.button-group button:hover {
background-color: #2980b9;
}
.button-group button.selected {
background-color: #2ecc71;
}
.action-button {
display: inline-block;
padding: 12px 24px;
font-size: 16px;
border: none;
background-color: #3498db;
color: white;
cursor: pointer;
border-radius: 4px;
transition: background-color 0.3s;
margin-right: 10px;
margin-top: 20px;
}
.action-button:hover {
background-color: #2980b9;
}
.action-button:disabled {
background-color: #95a5a6;
cursor: not-allowed;
}
.action-button.reset {
background-color: #e74c3c;
}
.action-button.reset:hover {
background-color: #c0392b;
}
.round-section {
background-color: #f8f9fa;
border-radius: 8px;
padding: 15px;
margin-bottom: 20px;
border: 1px solid #e9ecef;
}
.info-display {
background-color: #e3f2fd;
padding: 10px;
border-radius: 4px;
margin: 10px 0;
font-size: 18px;
}
.info-display .value {
font-weight: bold;
color: #1565c0;
}
.betting-info {
background-color: #fff3cd;
padding: 10px;
border-radius: 4px;
margin: 15px 0;
border: 1px solid #ffeaa7;
}
.pot-info {
background-color: #d4edda;
padding: 10px;
border-radius: 4px;
margin: 15px 0;
border: 1px solid #c3e6cb;
}
</style>
</head>
<body>
<div class="container">
<h1>Rock Paper Scissors Poker Calculator</h1>
<div class="input-group">
<label for="players">Number of players:</label>
<input type="number" id="players" min="2" value="4">
</div>
<div class="input-group">
<label for="ante">Ante amount:</label>
<input type="number" id="ante" min="1" value="1">
</div>
<h2>Rounds</h2>
<div id="rounds">
<div class="round-section">
<h3>Pre-flop</h3>
<div class="info-display" id="rockSize0">
Rock Size (bet per rock): <span class="value">$2</span>
</div>
<label>Rocks:</label>
<div class="button-group" id="rocks0"></div>
<label>Players in next round:</label>
<div class="button-group" id="players0"></div>
<div class="betting-info" id="totalBet0">
Bet Amount: <span class="value">$0</span>
</div>
<div class="pot-info" id="newPot0">
Pot: <span class="value">$4</span>
</div>
</div>
</div>
<button onclick="nextRound()" id="nextRoundButton" class="action-button">Next Round</button>
<button onclick="resetGame()" class="action-button reset">Reset Game</button>
</div>
<script>
let rounds = [{ rocks: 0, players: 4 }];
let pots = [0]; // Track pot at the start of each round
function calculatePotAtRoundStart(roundIndex) {
const initialPlayers = parseInt(document.getElementById('players').value);
const ante = parseInt(document.getElementById('ante').value);
let pot = initialPlayers * ante;
for (let i = 0; i < roundIndex; i++) {
const betSize = Math.floor(pot / 2);
const playersInNextRound = rounds[i].players;
pot += rounds[i].rocks * betSize * playersInNextRound;
}
return pot;
}
function updateRoundDisplay(index) {
const pot = calculatePotAtRoundStart(index);
const rockSize = Math.floor(pot / 2);
const totalBet = rounds[index].rocks * rockSize;
const playersInRound = rounds[index].players;
const newPot = pot + (totalBet * playersInRound);
// Update Rock Size
const rockSizeElement = document.getElementById(`rockSize${index}`);
if (rockSizeElement) {
rockSizeElement.querySelector('.value').textContent = `$${rockSize}`;
}
// Update Total Bet
const totalBetElement = document.getElementById(`totalBet${index}`);
if (totalBetElement) {
totalBetElement.querySelector('.value').textContent = `$${totalBet}`;
}
// Update New Pot
const newPotElement = document.getElementById(`newPot${index}`);
if (newPotElement) {
newPotElement.querySelector('.value').textContent = `$${newPot}`;
}
}
function updateAllRounds() {
for (let i = 0; i < rounds.length; i++) {
updateRoundDisplay(i);
}
}
function updateRocks(index, value) {
rounds[index].rocks = value;
updateButtonStyles('rocks' + index, value);
updateAllRounds();
}
function updatePlayers(index, value) {
rounds[index].players = value;
updateButtonStyles('players' + index, value);
updateRocksButtons(index, value);
// Update all rounds starting from the next round since player count affects subsequent rounds
updateAllRounds();
}
function updateButtonStyles(groupId, selectedValue) {
const buttons = document.querySelectorAll(`#${groupId} button`);
buttons.forEach(button => {
if (parseInt(button.textContent) === selectedValue) {
button.classList.add('selected');
} else {
button.classList.remove('selected');
}
});
}
function createButtonGroup(containerId, maxValue, updateFunction, initialValue) {
const container = document.getElementById(containerId);
container.innerHTML = '';
for (let i = 0; i <= maxValue; i++) {
const button = document.createElement('button');
button.textContent = i;
button.onclick = () => updateFunction(parseInt(containerId.slice(-1)), i);
container.appendChild(button);
}
updateButtonStyles(containerId, initialValue);
}
function updateRocksButtons(index, maxRocks) {
createButtonGroup(`rocks${index}`, maxRocks, updateRocks, Math.min(rounds[index].rocks, maxRocks));
}
function nextRound() {
if (rounds.length < 4) {
const index = rounds.length;
const prevPlayers = rounds[index - 1].players;
rounds.push({ rocks: 0, players: prevPlayers });
const roundNames = ['Flop', 'Turn', 'River'];
const roundDiv = document.createElement('div');
roundDiv.className = 'round-section';
roundDiv.innerHTML = `
<h3>${roundNames[index - 1]}</h3>
<div class="info-display" id="rockSize${index}">
Rock Size (bet per rock): <span class="value">$0</span>
</div>
<label>Rocks:</label>
<div class="button-group" id="rocks${index}"></div>
<label>Players in next round:</label>
<div class="button-group" id="players${index}"></div>
<div class="betting-info" id="totalBet${index}">
Bet Amount: <span class="value">$0</span>
</div>
<div class="pot-info" id="newPot${index}">
Pot: <span class="value">$0</span>
</div>
`;
document.getElementById('rounds').appendChild(roundDiv);
createButtonGroup(`rocks${index}`, prevPlayers, updateRocks, 0);
createButtonGroup(`players${index}`, parseInt(document.getElementById('players').value), updatePlayers, prevPlayers);
updateAllRounds();
if (rounds.length === 4) {
document.getElementById('nextRoundButton').disabled = true;
}
}
}
function resetGame() {
const currentPlayers = parseInt(document.getElementById('players').value);
rounds = [{ rocks: 0, players: currentPlayers }];
const roundDivs = document.querySelectorAll('#rounds > .round-section');
for (let i = 1; i < roundDivs.length; i++) {
roundDivs[i].remove();
}
createButtonGroup('rocks0', currentPlayers, updateRocks, 0);
createButtonGroup('players0', currentPlayers, updatePlayers, currentPlayers);
document.getElementById('nextRoundButton').disabled = false;
updateAllRounds();
}
document.getElementById('players').addEventListener('change', function () {
const newValue = parseInt(this.value);
rounds.forEach((round, index) => {
round.players = Math.min(round.players, newValue);
createButtonGroup(`players${index}`, newValue, updatePlayers, round.players);
updateRocksButtons(index, round.players);
});
updateAllRounds();
});
document.getElementById('ante').addEventListener('change', updateAllRounds);
const initialPlayers = parseInt(document.getElementById('players').value);
createButtonGroup('rocks0', initialPlayers, updateRocks, 0);
createButtonGroup('players0', initialPlayers, updatePlayers, initialPlayers);
updateAllRounds();
</script>
</body>
</html>