> 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/hackgrid.md).

# Hackgrid

<figure><img src="https://1591991476-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPIxZnZDGzl5v0n1I2OKQ%2Fuploads%2FyQUYuXV0ymSOMra0DFcg%2Fimage.png?alt=media&amp;token=5bc183c5-feb3-491f-88c8-04304dcced5a" alt=""><figcaption></figcaption></figure>

A Cyberpunk-style breach protocol. The player navigates an `N×N` hex grid, selecting cells to match daemon sequences. Moves alternate between row-locked and column-locked. Upload all daemons before the buffer runs out.

## Options

| Option    | Type   | Default | Description                                                                                           |
| --------- | ------ | ------- | ----------------------------------------------------------------------------------------------------- |
| `size`    | number | `5`     | Grid dimension — the board is `size × size` cells (4–6).                                              |
| `daemons` | number | `2`     | Number of daemon sequences to upload (1–4).                                                           |
| `seqLen`  | number | `3`     | Symbols per daemon sequence (2–4).                                                                    |
| `buffer`  | number | `8`     | Total selections available before the buffer exhausts and the run ends. Must be `≥ daemons × seqLen`. |
| `time`    | number | `45`    | Time limit in seconds.                                                                                |

## Example

```lua
-- Standard server breach:
exports['jiffy-minigames']:Hackgrid({
    size    = 5,
    daemons = 2,
    seqLen  = 3,
    buffer  = 8,
    time    = 45,
}, function(success)
    if success then
        TriggerServerEvent('hack:server:accessGranted')
    end
end)

-- High-difficulty Arasaka mainframe:
local success = exports['jiffy-minigames']:Hackgrid({
    size    = 6,
    daemons = 4,
    seqLen  = 4,
    buffer  = 10,
    time    = 60,
})
```

## How it works

1. The grid is filled with hex symbols.
2. **Daemon sequences** are shown on the right — short chains of symbols that must be matched in order.
3. The player starts by selecting any cell in the **first row** (row-locked).
4. The next selection must be in the **same column** as the previous pick (column-locked).
5. Moves alternate row → column → row each turn.
6. The game guarantees at least one valid solution path exists every run.
7. When a daemon sequence is matched in the buffer, it flashes **UPLOADED ✓** and locks in.
8. Win by uploading all daemons. Lose when the buffer fills without completing all sequences or time runs out.

## Notes

* Tighter buffers (`buffer = daemons × seqLen`) mean zero wasted moves — every selection must advance a daemon.
* Larger grids (`size = 6`) increase the number of distractors and make path-planning harder.
* The guaranteed-solvable path generation means the puzzle is never impossible, regardless of options.
