# Snake — Side Panel

Snake — Side Panel is a classic Snake game packaged as a Google Chrome Manifest V3 extension. It opens in Chrome's native Side Panel, so you can play alongside the page you are browsing without opening a separate tab, popup, or floating window.

The extension uses a restrained monochrome interface with System, Light, and Dark themes. The game has a 20 × 20 board, a growing snake, red food, score and personal-best tracking, and keyboard, button, and swipe controls.

## Requirements

- Google Chrome 116 or newer.
- Developer mode enabled for a manual installation from source.
- No account, external service, or network connection is required to play.

## Get Snake

### Option 1 — Clone the repository

Once the official Snake repository URL has been published, clone it with:

```bash
git clone <SNAKE_REPOSITORY_URL>
cd <SNAKE_REPOSITORY_FOLDER>
```

Replace the placeholders with the actual URL and folder name for the official **Snake — Side Panel** repository. Then locate the extension folder—the folder that contains `manifest.json` directly. That is the folder you will load in Chrome.

### Option 2 — Download the project ZIP

1. Download the Snake — Side Panel ZIP supplied by the project maintainer or from its official release page.
2. Extract the downloaded archive to a folder on your computer.
3. Locate the Snake extension folder—the folder that contains `manifest.json` directly.

Keep the extracted folder in a stable location. Chrome loads the extension from that folder.

## Install in Chrome

1. Open Google Chrome and go to `chrome://extensions`.
2. Turn on **Developer mode** using the switch near the top-right corner.
3. Select **Load unpacked**.
4. Choose the Snake extension folder. Make sure `manifest.json` is directly inside the selected folder, rather than one folder deeper.
5. Confirm that **Snake — Side Panel** appears in your extensions list.
6. Select the Snake toolbar icon to open the game in Chrome's side panel. If the icon is hidden, open Chrome's Extensions menu and pin Snake to the toolbar.

To install an update, replace the project folder with the updated version, return to `chrome://extensions`, and select **Reload** on the Snake extension card. If you moved the folder, remove the old unpacked entry and load the new folder using **Load unpacked**.

## How to play

The playfield is a 20-column × 20-row grid. Start a run, steer the snake toward the red food, and avoid the walls and the snake's own body. Each food item makes the snake longer and adds 10 points to the score. The run ends when the snake collides with a wall or itself.

The game runs at a steady interval. It does not currently include levels, speed upgrades, wrap-around walls, sound, online leaderboards, or additional game modes.

### Controls

| Action | Keyboard | On-screen / touch |
| --- | --- | --- |
| Move up | `↑` or `W` | Up button / swipe up |
| Move down | `↓` or `S` | Down button / swipe down |
| Move left | `←` or `A` | Left button / swipe left |
| Move right | `→` or `D` | Right button / swipe right |
| Pause / resume | `P` or `Esc` | Pause / Resume button |
| Restart | `R` | Restart button |
| Start / resume after pause / play again | `Enter` when the board action is available | Board overlay action |

For keyboard play, focus the board first. You can also use the on-screen direction buttons or swipe across the board. A short tap is not interpreted as a swipe. The game automatically pauses when the side-panel document becomes hidden; it waits for you to resume when you return.

## Features

- Opens in Chrome's native Side Panel from the extension toolbar icon.
- Classic Snake gameplay on a 20 × 20 grid.
- Snake growth and 10-point food collection scoring.
- Collision detection for the board edges and the snake's body.
- Live score, personal best, move counter, and snake-length readouts.
- Ready, playing, paused, and game-over states.
- System, Light, and Dark themes, cycled with the theme button.
- Light theme with a white application background, dark snake, and red food; the Dark theme keeps a dark board and uses a light snake with red food.
- Keyboard, on-screen direction-button, and pointer/swipe controls.
- Automatic pause when the side panel is hidden.
- Personal best and theme preference saved locally.
- Compact layout with the visible page scrollbar hidden; normal page scrolling remains available when needed.
- No account, analytics, remote code, or external game service.

## How the extension works

- `manifest.json` declares the Manifest V3 extension, its required permissions, toolbar action, side-panel page, service worker, icons, and minimum Chrome version.
- `service-worker.js` configures Chrome to open the native side panel when the extension toolbar action is clicked.
- `sidepanel.html` provides the semantic interface and loads the local stylesheet and game script.
- `sidepanel.css` contains the application layout, monochrome theme tokens, game-board colours, responsive rules, button states, and accessibility-related presentation.
- `game.js` implements Snake movement, collision handling, food placement, scoring, rendering, game states, keyboard and pointer controls, automatic pause, and local best-score/theme persistence.
- `assets/` contains the PNG icons used by Chrome at the declared extension icon sizes.

The game executes locally in the side-panel page. The manifest requests only the `sidePanel` and `storage` permissions. It does not declare website host permissions or content scripts, and the project does not include remote scripts, external libraries, analytics, or account functionality.

## Project files

| File or folder | Purpose |
| --- | --- |
| `manifest.json` | Chrome Manifest V3 configuration, permissions, toolbar action, side-panel entry point, service worker, minimum Chrome version, and icon declarations. |
| `service-worker.js` | Configures the toolbar action to open the native Chrome side panel. |
| `sidepanel.html` | Main side-panel document and semantic interface structure. |
| `sidepanel.css` | Layout, themes, board and snake colours, responsive styles, button states, and focus presentation. |
| `game.js` | Snake game engine, movement, food placement, collisions, scoring, rendering, states, controls, and local preference / best-score storage. |
| `assets/icon-16.png` | 16 × 16 Chrome toolbar icon. |
| `assets/icon-32.png` | 32 × 32 icon export. |
| `assets/icon-48.png` | 48 × 48 Chrome extension icon. |
| `assets/icon-128.png` | 128 × 128 icon export. |
| `README.md` | Project overview, installation instructions, controls, and file guide. |
| `license.txt` | Proprietary source-available license. Read it before using the source or an official release. |
| `contributing.md` | Bug-report and improvement-suggestion guidance, subject to the project license. |
| `security.md` | Permissions, local-data handling, and vulnerability-reporting guidance. |
| `changelog.md` | User-facing release history. |

## Data, privacy, and security

The extension saves the personal-best score and selected theme using `chrome.storage.local`. When run outside an extension context for local preview, it can fall back to browser `localStorage`. The current game session is held in the side-panel page and is not saved as a restorable run after the page is closed.

The extension does not need access to the websites you visit. It does not implement an account system, analytics, or remote data transmission. Read [`security.md`](security.md) for more details.

## Contributing and license

Bug reports and improvement suggestions are welcome. Please read [`contributing.md`](contributing.md) before submitting feedback. The project is distributed under the proprietary source-available terms in [`license.txt`](license.txt), not an OSI-approved open-source license. Public source visibility does not grant general rights to modify, redistribute, or commercially use the Software. Read the license before proceeding.

## Contact

- Security reports and permission requests: [Darsh.seraphic@gmail.com](mailto:Darsh.seraphic@gmail.com)
