Plinkoにおけるプロバブリーフェアの仕組み
CloudbetでのPlinkoの遊び方と、各ボールの軌道がプロバブリーフェアであることを確認する方法をご紹介します。
Plinkoの遊び方
Plinkoは、ピンが並んだピラミッドにボールを落とし、それが跳ねながら配当にたどり着く様子を見守る運のゲームです。ボールを落とす前に、ベット額、ピラミッドの段数、リスクレベルを設定します。段数が多く、リスクレベルが高いほど、当たったときの倍率は大きくなりますが、その分当てるのは難しくなります。ボールを落とすと、各段のピンに当たるたびに左右に跳ねながら落ちていき、最終的に一番下にあるバケットの1つに着地します。各バケットにはそれぞれ倍率が設定されています。多くのPlinkoゲームでは、複数のボールを同時に落として、よりスピーディにプレイすることもできます。
Cloudbet Originals Plinko
CloudbetオリジナルのPlinkoでは、8段・10段・12段・16段の中から段数を選べるほか、4段階のリスクレベル(Low、Medium、High、Extreme)、そして1・5・10・20・50・100個のボールを1回に落とすことができます。RTPは99%です。オプションのBOOST機能(ベット額に20%のサーチャージが加わります)では、特別な2倍・5倍・10倍のボール倍率が追加され、最大倍率が100,000倍まで引き上げられます(総配当の上限は$1,000,000)。
サーバーシード、クライアントシード、ノンス、ハッシュ化、結果の検証方法など、プロバブリーフェアの一般的な仕組みについては、Cloudbetのプロバブリーフェアシステムをご覧ください。以下では、それが具体的にPlinkoにどう適用されるかを解説します。
ボールの軌道からバケットへの変換
ピラミッドを落ちていく各ボールの軌道は、ピンに当たる一連の跳ね返りであり、それぞれの跳ね返りは左方向か右方向のいずれかになります。

この選択は「0」(左方向)または「1」(右方向)として符号化できます。「左方向、左方向、右方向」という軌道は「001」というコードになり、これに従うとボールはバケット2番に着地します。

ここで重要なパターンがあります。軌道は、右方向への跳ね返りの回数に1を足した番号のバケットに着地します。つまり「100」「010」「001」——いずれも「1」がちょうど1回だけ含まれる——は、すべてバケット2番(1 + 1)に着地します。

これにより、ランダムな軌道を1つの手順で生成・符号化できます。32ビットの乱数を1つ取り、その最初のNビット(Nは段数)を読み取り、それらのビットのうち「1」がいくつあるかを数えます。それに1を足したものが、ボールが着地するバケットになります。バケットはラウンドが始まる前にサーバー上で計算・確定され、ラウンドが終了するまで非公開のまま保持された後、公開されます。
ご自身のPlinkoゲームのプロバブリーフェアを検証する
以下のコードはCloudbetのPlinko実装に忠実なものです。サーバーシード、クライアントシード、ノンス、ボールの数、段数を入力し、唯一の依存パッケージをインストールして実行してください。
npm install js-sha3
依存パッケージをインストールしたら、以下のコードブロックにご自身のデータを入力してください。
// 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
let myNumberOfBalls = 1; // ✍️YOUR_INPUT✍️: Enter your number of balls here
let myNumberOfRows = 12; // ✍️YOUR_INPUT✍️: Enter your number of rows 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 with a 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: Sample bits to determine ball paths
function pickBuckets(numOfRows, numOfBalls, rng) {
let bucketIndices = [];
for (let i = 0; i < numOfBalls; i++) {
const rawUint32 = rng.next().value;
let pathArray = rawUint32.toString(2).padStart(32, '0').split(""); // Convert the number into an array of bits
pathArray.splice(numOfRows); // Select the the first bits for the number of rows
bucketIndices.push(getBucketIndexFromPath(pathArray));
}
return bucketIndices;
}
// Calculates which bucket the ball would land in an array of 1's and 0's where 0 = leftwards, 1 = rightwards
// In principle it counts the amount of times the ball bounces rightwards
function getBucketIndexFromPath(pathArray) {
let rightCounter = 0;
for(let i = 0; i < pathArray.length; ++i) {
if (pathArray[i] === '1') {
rightCounter += 1;
} else {
rightCounter += 0;
}
}
return rightCounter + 1; // Add one so that the left-most bucket is bucket number one
}
// Example usage
(function main() {
let numOfRows = 12;
let numOfBalls = 1;
let nonce = 1;
if (usingCustomData) { numOfRows = myNumberOfRows; numOfBalls = myNumberOfBalls; nonce = myNonce; }
const { serverSeed, commitment } = generateServerSeed();
const clientSeed = getClientSeed();
const roundSignature = createRoundSignature(serverSeed, clientSeed, nonce);
const numbersToGenerate = numOfBalls; // Only need to generate one number per ball
const rng = createRandomNumberSequence(numbersToGenerate, roundSignature);
const bucketIndices = pickBuckets(numOfRows, numOfBalls, 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('📋 Number of rows:', numOfRows);
console.log('🏁 Buckets landed in (Bucket #1 is the leftern-most bucket):', bucketIndices);
})();
補足:Cloudbetでゲームのサーバーシードを公開するには、まず新しいサーバーシードにローテーションする必要があります。
