# Minigames

The laptop includes built-in minigames that you can easily trigger in your own scripts using the provided exports.

#### Alphabet

* A sequence of random letters will be displayed on a terminal interface, and the player must type the exact characters before the timer runs out.

<figure><img src="https://1688068901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9bCwnajAqpi3Viykb5Wi%2Fuploads%2FYYzQVcTtDQg1S02qV1Gm%2F%7B1CC0CF22-71DE-4FE4-BFDC-A9E3F8E3BD2D%7D.png?alt=media&#x26;token=4b1759e8-d38b-46d4-962d-55cd69ee7c03" alt=""><figcaption></figcaption></figure>

> **params:**
>
> * **rounds**:`number` The total number of consecutive rounds the player must complete to win the minigame.
> * **keys**:`number` The amount of characters generated in each round that the player needs to type.
> * **time**:`number` The time limit (in seconds) the player has to complete *each* individual round.
>
> **returns:**
>
> * **result**:`boolean`
>
> <pre class="language-lua"><code class="lang-lua"><strong>local settings = {
> </strong>    keys = 5,
>     time = 10,
>     rounds = 3
> }
> local res = exports['av_laptop']:useMinigame("alphabet", settings)
> </code></pre>

#### Cracker

* This minigame challenges the player's memory and reaction speed. A random sequence of keys will appear on the screen, and the user must replicate the exact pattern before the timer runs out.

<figure><img src="https://1688068901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9bCwnajAqpi3Viykb5Wi%2Fuploads%2FfNsZUmdsKdScXaoCJBlF%2F%7B774A5758-0C82-4954-BB87-B7F6ADB9FC7F%7D.png?alt=media&#x26;token=895dfe78-5c6a-444d-95e2-a9ec2f9097cb" alt=""><figcaption></figcaption></figure>

> **params:**
>
> * **keys:**`number` The amount of keys generated in the sequence that the player needs to replicate.
> * **time:**`number` The total time limit (in seconds) the player has to complete the minigame
>
> **returns:**
>
> * **result**:`boolean` true or false
>
> <pre class="language-lua"><code class="lang-lua"><strong>local settings = {
> </strong><strong>    keys = 6,
> </strong><strong>    time = 8
> </strong><strong>}
> </strong><strong>local result = exports['av_laptop']:useMinigame("cracker", settings)
> </strong><strong>print(result) -- true/false
> </strong></code></pre>

#### Grid

* The player must memorize the exact pattern and click the blocks in the same order.

<figure><img src="https://1688068901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9bCwnajAqpi3Viykb5Wi%2Fuploads%2FWmd09ckDtP7hyszNUEST%2F%7BB4116C0A-98E2-4976-AEA4-10972533435D%7D.png?alt=media&#x26;token=4738124d-2f53-45f3-a7a0-059f95300e4a" alt=""><figcaption></figcaption></figure>

> **params:**
>
> * **steps**:`number` The total number of blocks that will light up in the sequence for the player to memorize and repeat.
>
> **returns:**
>
> * **result**:`boolean`&#x20;
>
> ```lua
> local settings = {
>     steps = 5
> }
> local res = exports['av_laptop']:useMinigame("grid", settings)
> if res then
>     print("The player successfully replicated the grid sequence!")
>     -- Add your reward/success logic here
> else
>     print("The player failed the minigame.")
>     -- Add your penalty/failure logic here
> end
> ```

#### Memory

* A series of different figures or shapes will appear on the screen one by one. For each figure, the player must quickly determine if it is a "New" shape they haven't seen yet, or a "Seen" shape that has already appeared during the current session

<figure><img src="https://1688068901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9bCwnajAqpi3Viykb5Wi%2Fuploads%2FhfK9VyJPF2Ixp2sZgohs%2F%7B26276FC1-D879-4FE2-BB94-1444A12E08A8%7D.png?alt=media&#x26;token=19fa881a-d9ee-456d-bfe7-2a32a85e920e" alt=""><figcaption></figcaption></figure>

> **params:**
>
> * **limit:**`number` The total amount of figures that will be shown to the player during the minigame.
> * **time:**`number` The time limit (in seconds) the player has to make a decision (Seen or New) for each figure
>
> **returns:**
>
> * **result:**`boolean`&#x20;
>
> ```lua
> local settings = {
>     limit = 10,
>     time = 2
> }
> local res = exports['av_laptop']:useMinigame("memory", settings)
> print(res)
> ```

#### Packets

* A constant "rain" of varied icons (shapes and colors) falls down the screen. A target icon, with a specific color and symbol, is shown as the objective. The player must quickly identify and click on the falling packets that exactly match the target criteria.

<figure><img src="https://1688068901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9bCwnajAqpi3Viykb5Wi%2Fuploads%2FZg0dGlDZh3Wwm5dxwfmf%2F%7B3527CC51-E4F1-4E3E-AFC1-3CC06AB9E2A6%7D.png?alt=media&#x26;token=5601b83f-0280-445a-b627-88e7e63f1bb7" alt=""><figcaption></figcaption></figure>

> **params:**
>
> * **limit**:`number` The exact quantity of correct packets that the player must successfully click to complete the minigame.
>
> **returns:**
>
> * **result:**`boolean`
>
> ```lua
> local settings = {
>     limit = 10
> }
> local res = exports['av_laptop']:useMinigame("packets", settings)
> print(res)
> ```

#### Sniffer

* The system assigns a specific target payload (a unique shape and color combination). As various nodes pop up and disappear across the grid, the player must quickly intercept (click) the correct targets.

<figure><img src="https://1688068901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9bCwnajAqpi3Viykb5Wi%2Fuploads%2FDzlLMlBxmDQQLgWl2fXa%2F%7B9842523B-613E-485F-8BC9-408558C4226A%7D.png?alt=media&#x26;token=fe15378c-f2b2-4abd-9096-09fdc48b86b2" alt=""><figcaption></figcaption></figure>

> **params:**
>
> * **limit:**`number` The number of target nodes the player must successfully click and intercept to win the minigame.
>
> **returns:**
>
> * **result:**`boolean`&#x20;
>
> ```lua
> local settings = {
>     limit = 10
> }
> local result = exports['av_laptop']:useMinigame("sniffer", settings) 
> ```

#### Sniper

* As various random shapes rapidly pop up across the screen, the player must quickly "snipe" (click) the correct targets. Clicking an incorrect figure or letting the timer run out will result in an immediate failure.

<figure><img src="https://1688068901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9bCwnajAqpi3Viykb5Wi%2Fuploads%2Fsx1S3SIhuLfvMj81vDH6%2F%7BB36E2EEF-1A22-4219-A97C-A4B7C7957141%7D.png?alt=media&#x26;token=1761b404-337f-4e68-b4c7-0c15e4094c7b" alt=""><figcaption></figcaption></figure>

> **params:**
>
> * **limit:**`number` The exact quantity of correct target nodes the player must successfully click to complete the minigame.
> * **time:**`number` The total time limit (in seconds) the player has to complete the challenge.
>
> **returns:**
>
> * **result:**`boolean`&#x20;
>
> ```lua
> local settings = {
>     limit = 15,
>     time = 20
> }
> local result = exports['av_laptop']:useMinigame("sniper", settings) 
> ```
