> For the complete documentation index, see [llms.txt](https://doc.lucky-cycle.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.lucky-cycle.com/games/index/snake.md).

# Snake

{% hint style="warning" %}
Demo: <https://campaigns.lucky-cycle.com/utils/games?game=snake>
{% endhint %}

1. [#configuration](#configuration "mention")
2. [#options](#options "mention")
3. [#assets](#assets "mention")

### Configuration

<details>

<summary>JSON</summary>

```json
{
  "options": {
    "header_background_color": "black",
    "header_text_color": "white",
    "number_case": 8,
    "spawn": {
      "x": 4,
      "y": 7
    },
    "case_per_second": 1.25,
    "max_case_per_second": 5,
    "acceleration_percent": 10,
    "direction": {
      "url": GAME_URL + "/arrow.png"
    },
    "snake": {
      "direction": "N",
      "url": GAME_URL + "/snake.png"
    },
    "apple": {
      "url": GAME_URL + "/apple.png"
    },
    "background": {
      "url": GAME_URL + "/background.png"
    },
    "tuto": {
      "mobile": GAME_URL + "/tutorial_mobile.gif",
      "desktop": GAME_URL + "/tutorial_desktop.gif"
    }
  },
  "texts": {
    "en": {
      "score": "Score",
      "unit": "Apple(s)"
    },
    "fr": {
      "score": "Score ",
      "unit": "Pomme(s)"
    },
    "nl": {
      "score": "Score",
      "unit": "Appel(s)"
    }
  },
  "images": {
    "rewards": {}
  }
}
```

</details>

### Options

<table><thead><tr><th>Key</th><th>Type</th><th>Explanation</th><th>Default</th></tr></thead><tbody><tr><td><pre><code>header_background_color
header_text_color
</code></pre></td><td>String</td><td>Colour / background of the header.</td><td>"black" / "white"</td></tr><tr><td><pre><code>number_case
</code></pre></td><td>Integer</td><td>Number of cells in a row / column (total cells will be <em>number_cases</em>² as the game is always a square).</td><td>8</td></tr><tr><td><pre><code>spawn > x / y
</code></pre></td><td>Integer</td><td>Indexes of the start cell.</td><td>4 / 7</td></tr><tr><td><pre><code>case_per_second
</code></pre></td><td>Integer</td><td>Base speed.</td><td>1.25</td></tr><tr><td><pre><code>max_case_per_second
</code></pre></td><td>Integer</td><td>Max speed.</td><td>5</td></tr><tr><td><pre><code>acceleration_percent
</code></pre></td><td>Integer</td><td>Acceleration <em>(between 0 and 100)</em>.</td><td>10</td></tr><tr><td><pre><code>snake > direction
</code></pre></td><td>String</td><td>Starting direction <em>(could be N, S, E, W)</em>.</td><td>"N"</td></tr><tr><td><pre><code>score
</code></pre></td><td>String</td><td>Text in the header.</td><td>"Score"</td></tr><tr><td><pre><code>unit
</code></pre></td><td>String</td><td>Text in the header.</td><td>"Apple(s)"</td></tr></tbody></table>

### Assets

<table><thead><tr><th>Key</th><th>Size</th><th>Explanation</th><th>Default</th></tr></thead><tbody><tr><td><pre><code>direction > url
</code></pre></td><td>200 x 200px</td><td>Arrows (helper) to be displayed on touch screens.</td><td><a href="https://statics.lucky-cycle.com/files/_games/snake/arrow.png">/arrow.png</a></td></tr><tr><td><pre><code>snake > url
</code></pre></td><td><mark style="color:yellow;">(100*sprite)</mark> x 100px</td><td>Visual of the snake <mark style="color:orange;">(is a sprite of the snake parts!!)</mark>.</td><td><a href="https://statics.lucky-cycle.com/files/_games/snake/snake.png">/snake.png</a></td></tr><tr><td><pre><code>apple > url
</code></pre></td><td>100 x 100px</td><td>Visual of the item to retrieve.</td><td><a href="https://statics.lucky-cycle.com/files/_games/snake/apple.png">/apple.png</a></td></tr><tr><td><pre><code>background > url
</code></pre></td><td>500 x 500px</td><td>Background visual.</td><td><a href="https://statics.lucky-cycle.com/files/_games/snake/background.png">/background.png</a></td></tr><tr><td><pre><code>tuto > mobile / desktop
</code></pre></td><td>500 x 500px</td><td>Tutorial visual (can be animated, or not).</td><td><a href="https://statics.lucky-cycle.com/files/_games/snake/tutorial_desktop.gif">/tutorial_desktop.gif</a> / <a href="https://statics.lucky-cycle.com/files/_games/snake/tutorial_mobile.gif">/tutorial_mobile.gif</a></td></tr></tbody></table>
