> For the complete documentation index, see [llms.txt](https://mimoluck.gitbook.io/mimoluck-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mimoluck.gitbook.io/mimoluck-docs/documentation/general/interactive-blocks.md).

# Provably Fair Gameplay

Provably fair means you can mathematically verify that the death tiles were chosen before the game started and weren't changed after. Instead of just trusting us, you get a mathematical receipt that proves the game was fair.

This mean you can verify that:

* ✅ Wrong tile locations were determined **before** you made any moves
* ✅ We couldn't change the game outcome based on your choices
* ✅ The randomness was genuine and not manipulated

<figure><img src="https://2949272066-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9ERZrfMy4ELssJbo6nvR%2Fuploads%2FEHGsECVZJlK120ZmUWR0%2FFrame%20165.png?alt=media&amp;token=c562dccd-f429-480c-8191-e687d3869871" alt=""><figcaption></figcaption></figure>

***

### How It Works

**Game Creation:**

1. A random seed generates all Wrong tile locations.
2. A commitment hash (encrypted game fingerprint) is stored on-chain.

**During Play:**

* Your moves happen after the Wrong positions are locked.

**After Game:**

1. The seed is revealed.
2. Use the verifier tool to confirm Wrong positions.

**Verification Steps:**

1. Record the commitment hash at the start (displayed below cash-out button).
2. Visit **mimoluck.fun/stats** and click **Verify**.
3. Data is auto-filled — click submit to confirm:
   * Seed matches the hash.
   * Wrong positions were pre-determined.
4. Review the open-source code for full transparency.

***

## The Algorithms

### **Wrong Tile Generation**

```javascript
function getDeathTileIndex(seed, rowIndex, totalTiles) {
  // Create unique string for this row
  const hashSource = `${seed}-row${rowIndex}`;

  // Generate SHA-256 hash
  const hash = crypto.createHash('sha256').update(hashSource).digest('hex');

  // Convert first 8 hex characters to number
  const numericHash = parseInt(hash.slice(0, 8), 16);

  // Use modulo to get position 0 to totalTiles-1
  return numericHash % totalTiles;
}
```

### **Complete Wrong Tile Location Process**

```javascript
function generateAllDeathTiles(seed, rowConfigs) {
  const deathTiles = [];

  for (let rowIndex = 0; rowIndex < rowConfigs.length; rowIndex++) {
    const totalTiles = rowConfigs[rowIndex].tiles;
    const deathTileIndex = getDeathTileIndex(seed, rowIndex, totalTiles);

    deathTiles.push({
      row: rowIndex,
      position: deathTileIndex,
      totalTiles: totalTiles,
    });
  }

  return deathTiles;
}
```

**Every round is verifiable** — no manipulation possible.\
✅ **All randomness** comes from secure cryptographic methods.\
✅ **Fully on-chain** using $ETH on the Base chain.

### Commitment Hash Generation

```javascript
function createCommitmentHash(version, rows, seed) {
  const gameData = JSON.stringify({
    version, // Algorithm version (e.g., "v1")
    rows, // Array of row configurations
    seed, // Random game seed
  });

  return '0x' + crypto.createHash('sha256').update(gameData).digest('hex');
}
```

### Seed Generation

```javascript
function generateGameSeed() {
  return crypto.randomBytes(32).toString('hex'); // 64-character hex string
}
```
