> For the complete documentation index, see [llms.txt](https://jiffyjrdevelopment.gitbook.io/jiffyjrdevelopmentdocs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jiffyjrdevelopment.gitbook.io/jiffyjrdevelopmentdocs/jiffy-jr-development-docs/jiffy-minigames/games/pattern.md).

# Pattern

<figure><img src="https://1591991476-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPIxZnZDGzl5v0n1I2OKQ%2Fuploads%2FKRdXVZEami5a6PnaMlpY%2Fimage.png?alt=media&amp;token=ef62fcec-1a0e-41ac-9b14-3ac7605c6a7c" alt=""><figcaption></figcaption></figure>

A crystal grid lights up in a sequence. After playback, the grid goes dark and the player must click the cells in the same order from memory. Repeat for the required number of rounds to win.

***

## Options

| Option       | Type   | Default    | Description                                                                 |
| ------------ | ------ | ---------- | --------------------------------------------------------------------------- |
| `difficulty` | string | `'medium'` | Preset. Sets `rounds` and `time`.                                           |
| `grid`       | number | `4`        | Grid dimension — the board is `grid × grid` cells (2–6).                    |
| `rounds`     | number | `3`        | Number of sequences to complete. The sequence grows by one cell each round. |
| `time`       | number | `20`       | Seconds the player has to input each round's sequence.                      |
| `showFor`    | number | `0.7`      | Seconds each cell stays lit during playback.                                |

***

## Example

```lua
-- Small grid, fast — guard panel bypass:
exports['jiffy-minigames']:Pattern({
    difficulty = 'medium',
    grid       = 3,
    rounds     = 3,
}, function(success)
    if success then
        TriggerServerEvent('my-script:server:disableAlarm')
    end
end)

-- Large grid, harder:
local success = exports['jiffy-minigames']:Pattern({
    difficulty = 'hard',
    grid       = 5,
    showFor    = 0.5,
})
```

***

## Notes

* The sequence for each round is freshly generated — no two games are the same.
* `showFor` is per-cell, not per-round. A 5-cell sequence at `showFor = 0.7` takes 3.5 s to play back.
* Larger grids (`grid = 5` or `6`) significantly increase difficulty because misclick positions are closer together.
