Files
vela-snake-m/README.md
T

1.8 KiB
Raw Blame History

SNAKE — classic snake for Xiaomi Watch S4

Classic snake on a 16×16 grid rendered on the round 466px screen (320px board, 20px cells). Swipe to steer; the crown is NOT used (confirmed unsupported by the Vela quick-app API on this device). Tap the overlay to restart after a crash.

Status: RENDERS AND PLAYS ON WATCH (user-confirmed since 0.2/0.3).

Controls

  • Swipe in any direction to turn (180° reversals are blocked in the logic)
  • Tap the game-over overlay to restart
  • Crown does nothing — no rotary API exists in Vela quick apps (triple-confirmed against docs + the largest open-source S4 app)

Project layout

src/
├── app.ux                  # app lifecycle
├── manifest.json           # com.ilias.snake, watch, designWidth 466
├── common/
│   ├── snake.js            # pure game logic: step/turn/spawnFood — unit-tested
│   └── icon.png            # 192×192 circular app icon
└── pages/index/index.ux    # board rendering (for-directive), swipe input, game loop
tests/
├── snake.cjs               # logic: self-collision, food, 180° block, wrap rules
└── page.cjs                # wiring: template binds, handlers, state machine

The game ticks on a 300ms setInterval, cleared on hide/destroy.

Build & test

npm ci
npm run release          # signed .rpk → dist/
node tests/snake.cjs     # logic tests
node tests/page.cjs      # page wiring tests

Install

Side-load dist/com.ilias.snake.release.*.rpk via AstroBox. Releases: https://gitea.oimcloud.myaddr.tools/codex-bot/vela-snake

Version notes

  • 0.2 — board renders on watch (user confirmed); ring undersized
  • 0.3 — designWidth 480→466 fixed the undersized bezel
  • Crown-based input was tried and disproven — swipe is the only reliable input