Jak działa provably fair w grze Dice: Golden Ticket
Oto jak grać w Dice: Golden Ticket na Cloudbet oraz jak sprawdzić, że każdy rzut i losowanie Golden Ticket są provably fair.
Jak grać w Dice: Golden Ticket
Dice: Golden Ticket (DGT) działa jak klasyczna gra Dice od Cloudbet, z jedną dodatkową warstwą: ukrytym celem bonusowym, który może wypłacić mnożnik bonusowy dodatkowo do Twojej zwykłej wygranej.
Gra podstawowa: wybierz Roll Over (2,00–99,99) lub Roll Under (0,01–98,00), a następnie postaw zakład. Jeśli kostka wyląduje po Twojej stronie celu, wygrywasz przy wypłacie wynikającej z Twojego celu (węższy cel = wyższy mnożnik).
Bonus Golden Ticket: w każdej rundzie na planszy ustawiana jest również druga, ukryta wartość — Golden Ticket — z własnym mnożnikiem bonusowym od 3x do 200x. Jeśli Twój rzut kostką wyląduje w zakresie ±1,75 od pozycji Golden Ticket, wygrywasz bonusową wypłatę przy tym mnożniku, natychmiast i automatycznie — bez dodatkowego zakładu, a bonus sumuje się z Twoją zwykłą wygraną.
Nie celujesz bezpośrednio w Golden Ticket — nie możesz go wybrać ani na niego wpłynąć, po prostu zawsze znajduje się gdzieś na planszy w każdej rundzie, a wylądowanie blisko niego to bonus dodatkowy do Twojej zwykłej gry.
Cloudbet Originals Dice: Golden Ticket
Własna gra DGT od Cloudbet Originals ma RTP na poziomie 99%, maksymalny mnożnik kostki x6730 oraz maksymalną wygraną 1 000 000 $.
Dice: Golden Ticket (DGT) opiera się na tym samym fundamencie provably fair, co każda inna gra Cloudbet Originals — ogólne mechanizmy (Seed serwera, Seed klienta, Nonce, SHAKE256, próbkowanie odrzucające) opisano na stronie Jak działa provably fair. Losowanie wartości kostki działa tak samo, jak w zwykłym Dice — DGT dodatkowo dolicza wartość i mnożnik Golden Ticket. Poniżej opisano, jak ta sekwencja staje się konkretnie Twoim wynikiem w DGT.
Przekształcanie liczb losowych w wynik gry
DGT musi udowodnić, że dwie wartości są determinowane przez weryfikowalną losowość: wartość kostki oraz wartość Golden Ticket.
Proces jest prosty: najpierw losowana jest jedna liczba całkowita z zakresu od 0 do 10000 (włącznie), która staje się ostateczną wartością kostki. Następnie losowana jest kolejna liczba całkowita z zakresu od 175 do 9825 (włącznie), która staje się ostateczną wartością Golden Ticket. Obie liczby są dzielone przez 100, aby każda miała dwa miejsca po przecinku — w zakresie od 0 do 100 (kostka) oraz od 1,75 do 98,25 (Golden Ticket).
Zakres Golden Ticket jest celowo ograniczony do 1,75–98,25, a nie 0–100, aby niezależnie od tego, gdzie wyląduje, zawsze istniała pełna „złota strefa” o szerokości 3,5, w której wartość kostki może wygrać bonus. Gdyby zakres sięgał samych krańców (0 lub 100), Golden Ticket lądujący blisko krawędzi miałby mniejszą złotą strefę — a więc gorsze szanse — niż ten lądujący pośrodku.
DGT ma także unikalną cechę: mnożnik Golden Ticket sam w sobie jest generowany w procesie provably fair. Mówiąc prościej: losowana jest trzecia liczba losowa z zakresu od 0 do 1, która następnie jest przekształcana w mnożnik od 3 do 200 za pomocą obciętego rozkładu Pareto.

Szczegóły techniczne
Losowe bajty generowane przez SHAKE256 są dzielone na 4-bajtowe liczby całkowite bez znaku, z zakresu od 0 do 2³²-1. Ponieważ wartość kostki ma 10001 możliwych wyników (0–10000 włącznie), próbkowanie odrzucające używa P = 10001; wartość Golden Ticket ma 9651 możliwych wyników (175–9825 włącznie), więc jej P = 9651. (Zobacz stronę provably fair, aby dowiedzieć się, dlaczego ten krok jest ważny.)
Wybór wartości kostki i Golden Ticket: losowa liczba dla kostki jest poddawana operacji modulo 10001, aby uzyskać jej wartość. To samo robi się z losową liczbą dla Golden Ticket, używając 9651, a następnie wynik jest zwiększany o 175 (tak aby mieścił się w zakresie 175–9825). Obie wartości są następnie dzielone przez 100.
Wybór mnożnika Golden Ticket (przydatna jest tu pewna znajomość statystyki): losowana jest liczba 32-bitowa, która jest dzielona przez swoją maksymalną możliwą wartość, co daje jednostajnie rozłożoną liczbę z zakresu od 0 do 1. Ta wartość jest przekształcana w obcięty rozkład Pareto (dolna granica 3, górna granica 200, alfa 1,343 — dobrane tak, aby wartość oczekiwana mnożnika wynosiła 9, co utrzymuje docelowe RTP DGT na poziomie 99%), a następnie zaokrąglana do dwóch miejsc po przecinku.
Rozgrywka
Zarówno wartość kostki, jak i wartość Golden Ticket są generowane po stronie serwera i ukrywane do końca rundy — nie można ich niezauważenie zmienić po rozpoczęciu gry. Po postawieniu zakładu wybrany przez Ciebie próg jest porównywany z wartością kostki, a odległość Golden Ticket od wartości kostki jest sprawdzana względem 1,75 „złotej strefy”, aby ustalić, czy wygrywasz bonus.
Kod do niezależnej weryfikacji
Zgodny z implementacją DGT na Cloudbet — wprowadź swój Seed serwera, Seed klienta i Nonce, aby zweryfikować własne gry. (Aby ujawnić Seed serwera danej gry na Cloudbet, musisz już przejść na nowy Seed serwera.)
Zależności:
npm install js-sha3
Kod:
// If you are running this yourself, then you can input your own data here
// You can then compare:
// 1) Cloudbet's provided Commitment to the Commitment outputted here. This proves that the Server Seed was not altered during gameplay.
// 2) Cloudbet's provided game outcome to the game outcome outputted here. This proves that your game's outcome was determined solely by the pre-game seeds and was not altered afterwards.
let myServerSeed = 'your_server_seed'; // ✍️YOUR_INPUT✍️: Enter your (unhashed) Server Seed here
let myClientSeed = 'your_client_seed'; // ✍️YOUR_INPUT✍️: Enter your Client Seed here
let myNonce = 1; // ✍️YOUR_INPUT✍️: Enter your Nonce here
const usingCustomData = false; // Change this to true if you are using your own data
// Load libraries
const crypto = require('crypto');
const { sha3_256, shake256 } = require('js-sha3');
// Step 1: Generate a Server Seed and Commitment
// And generate a Client Seed - either by player input or by the player's browser
function generateServerSeed() {
let seed = crypto.randomBytes(32).toString('hex');
if (usingCustomData) { seed = myServerSeed; }
const commitment = sha3_256(seed);
return { 'serverSeed': seed, 'commitment': commitment };
}
function getClientSeed() {
let seed = crypto.randomBytes(32).toString('hex');
if (usingCustomData) { seed = myClientSeed; }
return seed;
}
// Step 2: Create a Round Signature with SHA3 using a Server Seed, Client Seed and Nonce
function createRoundSignature(serverSeed, clientSeed, nonce) {
return sha3_256(`${serverSeed}:${clientSeed}:${nonce}`);
}
// Step 3: Create a SHAKE256 stream generator from a Round Signature.
// To simplify this example program, this function doesn't create a stream, but instead a sequence of custom length.
function* createRandomNumberSequence(numbersToGenerate, roundSignature) {
const numOfBytes = 4 * numbersToGenerate; // 4 bytes (32 bits) per random number we generate
const byteStream = shake256.create(8 * numOfBytes); // shake takes bits as input
byteStream.update(roundSignature); // Use the Round Signature to seed the generator
const buf = Buffer.from(byteStream.digest()); // The Buffer class lets us package every 4 bytes into one 32-bit integer
for (let i = 0; i < numbersToGenerate; i++) {
yield buf.readUInt32BE(i * 4); // Read buf in 4-byte steps
}
throw new Error("No more numbers in the random number sequence! Fix: make 'numbersToGenerate' larger.");
}
// Step 4: Draw from the random number sequence to calculate the game result
function getGameResult(rng) {
// Dice
// Ranges from 0 to 100, with two decimal places
const diceMinValue = 0;
const diceMaxValue = 10000;
let diceValue = sampleFromRange(diceMinValue, diceMaxValue, rng);
diceValue = diceValue / 100; // Now the value ranges from 0 to 100
// Golden Ticket
// Ranges from 1.75 to 98.25 due to fairness
// (If it landed on 99, for example, then the chance of the dice landing near
// it would be smaller than the guarantee of 3.5%)
const gtMinValue = 175;
const gtMaxValue = 9825;
let goldenTicketValue = sampleFromRange(gtMinValue, gtMaxValue, rng);
goldenTicketValue = goldenTicketValue / 100;
// Golden Ticket Multiplier
const multiplier = getRandomNumberTruncatedPareto(rng); // Complicated maths, can be ignored ;)
return { diceValue, goldenTicketValue, multiplier };
}
// Sample a number using the truncated Pareto distribution
function getRandomNumberTruncatedPareto(rng) {
// Get a uniformly distributed number between 0 and 1
let randomInt32 = rng.next().value;
const fraction = randomInt32 / 0xFFFFFFFF;
// Truncated Pareto distribution. The expected value is 9.00
const m0 = 3;
const m1 = 200;
const alpha = 1.343;
const r = Math.pow(m0 / m1, alpha);
const inner = 1 - fraction * (1 - r);
let randomNumber = m0 / Math.pow(inner, 1 / alpha);
randomNumber = Math.round(randomNumber * 100) / 100; // Round to 2 decimal places
return randomNumber;
}
// Sample a number between 'min' to 'max' (inclusive) using Rejection Sampling
function sampleFromRange(min, max, rng) {
const P = max - min + 1;
const maxAcceptable = Math.floor(0x100000000 / P) * P;
// Rejection sampling
let rand;
do {
rand = rng.next().value;
} while (rand >= maxAcceptable);
// Modulo operation
const sampled_number = rand % P;
return sampled_number + min;
}
// Example usage
(function main() {
let nonce = 1;
if (usingCustomData) { nonce = myNonce; }
const { serverSeed, commitment } = generateServerSeed();
const clientSeed = getClientSeed();
const roundSignature = createRoundSignature(serverSeed, clientSeed, nonce);
const numbersToGenerate = 3 * 2; // We need 3 random numbers, however due to rejection sampling we may need more
const rng = createRandomNumberSequence(numbersToGenerate, roundSignature);
const { diceValue, goldenTicketValue, multiplier } = getGameResult(rng);
console.log('📝 Commitment (shown before the game):', commitment);
console.log('🔒 Server Seed (revealed after the game):', serverSeed);
console.log('🎲 Client Seed:', clientSeed);
console.log('🔢 Nonce:', nonce);
console.log('🔁 Round Signature (can be verified after the game):', roundSignature);
console.log('🎯 Dice landed on:', diceValue);
console.log('🎫 Golden ticket landed on:', goldenTicketValue);
console.log('⭐ Multiplier:', multiplier);
})();
