# RCWeb Bubblewrap

The **RCWeb Bubblewrap** app (`app/bubblewrap`) is the shared display for a fast multiplayer colour-control game. It pairs with `app/bubblewrap-c`, where each phone shows the same 6x6 bubble grid.

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

## What it does

- Shows a 6x6 grid of inflated bubble wrap on the main display.
- Displays a QR code for the room-specific controller URL.
- Assigns each controller a different player color.
- Re-inflates each popped bubble with the color of the player who touched it.
- Tracks the score for every player and declares the winner when one player owns all 36 bubbles.
- Uses a legacy browser display implementation intended for older WebKit/Tizen 2.4 devices.

## How to use it

1. Open `/bubblewrap/` on the main display.
2. Scan the QR code with one or more phones.
3. Tap bubbles on the phone grid to claim them.
4. Keep tapping until all bubbles are one player's color.

## Network API

The display exposes these functions globally under `bubblewrap`:

- `bubblewrap.joinPlayer(playerId)`: Registers a controller and sends it the current game state.
- `bubblewrap.popBubble(playerId, index)`: Claims a bubble for a player and broadcasts the update.
- `bubblewrap.resetGame(sender)`: Clears all bubble ownership while keeping the current players.

The display is authoritative for game state; controllers only request actions and render snapshots sent back from the display.
