# RCWeb Tetris Pro Control App

The **RCWeb Tetris Pro Control App** (`app/tetris-pro-c`) is the dedicated smartphone remote for the shared-screen Tetris Pro wall. It is designed for fast taps, repeated movement presses, and smooth game-over recovery without needing to walk back to the main display.

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

## What it does

- **Thumb-Friendly Tetris Pad**: Presents large left, right, rotate, soft-drop, and hard-drop controls sized for quick one-handed use on a phone.
- **Automatic Join Flow**: Opens from the viewer QR code and immediately starts requesting the next open Tetris board until the wall assigns the controller a slot.
- **Controller-Side Retry Flow**: When the player tops out, the phone shows a name field, the top 10 leaderboard, and a single **Try Again** action to save the score and restart.
- **Persistent Player Alias**: Remembers the last entered name locally, making repeat arcade sessions faster.

## How it works

The controller keeps its own UI state locally and sends only small RCWeb function calls back to the viewer.

- **Join and Heartbeat Loop**: `script.js` periodically sends `tetrisPro.requestJoin(...)` until assigned, then swaps to `tetrisPro.controllerHeartbeat(...)` so the wall can detect disconnects.
- **Repeat-Hold Input**: Left, right, and soft-drop buttons start timed repeat sends after a short delay, matching the feel of a physical arcade pad.
- **Targeted Viewer Feedback**: The main display publishes player state back to all controllers through `tetrisProControl.*` functions, and each phone filters those updates using its `rc.client` id.
