# RCWeb Snake Control App

The **RCWeb Snake Control App** (`app/snake-c`) is the dedicated web-based remote control (D-Pad) mapped specifically to the `app/snake` arcade game, acting exclusively within the **Asymmetric Pattern**.

![icon](pwa-512x512.png "Snake Control App Icon")

## Screenshot
![screenshot](screenshot.png "Snake Control App")

## What it does

- **Four-Way Directional Inputs**: Converts the mobile browser into a retro four-button control pad (Up, Down, Left, Right).
- **Haptic Confirmations**: Utilizing native browser functionality to provide instant, physical tactile feedback whenever a directional button is pressed.
- **Personal Game Status Dashboard**: Maintains a personalized tracking banner showing the user their currently assigned snake color, their active score in real-time, or their countdown timer if they crash.

## How it works

The `script.js` logic revolves entirely around translating user interactions into rapid string execution payloads bounded to the D-Pad constraint.

- **Unified Event Pipeline**: Binds both `mousedown` and `touchstart` DOM events, immediately short-circuiting them (`e.preventDefault()`, `e.stopPropagation()`) to eliminate default browser scrolling and zooming behaviors perfectly.
- **Haptic Actuation**: Every legitimate input fires `navigator.vibrate(50)` locally to ensure users don't have to look down at their phone to confirm their button press was registered by the glass screen.
- **Payload Directing**: Simple functions (e.g., `up()`, `down()`) trigger static `rc.send("snakeGame.up('" + rc.client + "');", "snake")` strings, telling the central screen engine exactly who is trying to pivot.
- **Global `window.*` API Listeners**: Exposes public JavaScript functions locally on the DOM (`window.updateScore`, `window.startCountdown`). The central `snake` game server pushes direct JavaScript evaluation payloads explicitly commanding the phone's browser to execute these functions and alter the local UI colors to dynamically match the screen.
