The Connect Four release on the fork's feature branch produced four reusable notes and one application archive, all under docs/reference/shinku-chen/: - two-device-ble-link: symmetric peer discovery with an address tiebreak instead of a host/join choice, the measured heap cost of the link on a part without PSRAM and its collision with a static screenshot buffer, two NimBLE traps that compile cleanly and only fail on hardware, the NVS requirement behind RF calibration caching, and the stop-and-wait layer a turn-based application needs. - landscape-rotation-and-deep-sleep-key-wake: rotating a portrait panel into a 320 x 240 landscape screen through LVGL, why the corner mask must follow the logical resolution, and how an ADC-owned pin makes a low-level deep-sleep wake fire at sleep entry. - on-device-game-ai-wall-clock-budget: why node-count limits misfire on this board (about 15k nodes per second), iterative deepening against a time budget, yielding to keep the idle task fed, and difficulty as a blunder rate. - release-artifact-verification: sizing a static buffer from the panel rather than guessing, reading the startup log of the published merged image, and replacing a release that shipped wrong rather than following it up. - connect-four: the functional summary of the published application. Both language versions are added together and the reference index lists all five entries. Documentation only: no code, configuration, partition table, or repository rule is touched, and the runtime two-device BLE transport this work informed is split into its own change.
3.9 KiB
简体中文 · English
Connect Four
A landscape Connect Four for the AI Passport. Hold the device sideways and play on a 10 × 7 board: face the computer at three difficulty levels, or pass the device back and forth with a second player.
Publish information
-
Title: Connect Four
-
Description: submitted as:
Turn the AI Passport into a pocket Connect Four board.
Hold it sideways and play on a 10 x 7 grid: move the column cursor with the up and down keys, drop a disc with OK, and connect four to win.
- Choose who starts: play first yourself, or let the computer open the game and watch it move.
- Play against the computer at three difficulty levels: pick the easy one for a relaxed win, or the hard one for a real match.
- Or hand the device back and forth: two players take turns on the same board.
- Choose how your next move is previewed: show exactly which slot the disc will land in, or only mark the top row of that column.
- Column moves, drops, wins and draws each have their own sound, and the device dims itself when idle - press any key to keep playing.
Hold OK to return to the settings screen at any time and switch mode, difficulty or preview style.
-
Category: games
-
Cover:
comm_cover.png(PNG, 1152 × 1536, 3:4) — publish metadata only; the cover image is not committed here.
What it does
- Boots straight into the game: the firmware opens its own settings screen, with no test menu and no network use.
- 10 × 7 board: 70 slots with four-in-a-row detection horizontally, vertically and on both diagonals; the winning four are ringed, and a full board is a draw.
- Three modes:
HUMAN vs AI(you move first),AI vs HUMAN(the computer opens the game and moves immediately), orTWO PLAYERStaking turns on the same device with a turn indicator. The two computer modes differ only in who moves first. - Three difficulty levels: easy, medium and hard. Every move is capped by a search time budget, so the computer answers well inside a second, and the lower levels deliberately play a weak move at a fixed rate so a new player can win.
- Selectable drop preview: either the slot the disc will really land in, or only the top row of the selected column.
- Sound: column moves, drops, wins, losses and draws each have their own cue; the cues are synthesized, so no audio files are stored.
- Idle deep sleep: after 60 seconds on the settings screen or 180 seconds in a
match, the device shows
SLEEPING, powers down and sleeps; any key wakes it and the game restarts at the settings screen. - Battery readout: live percentage in the top-right corner, turning red below
20% and showing
--when no reading is available.
Interaction
Three keys drive the whole app. Hold the device with its long edge horizontal; the "up" key is then the right-hand key.
Settings screen:
- UP / DOWN: pick a row (
MODE,LEVEL,PREVIEW,START). - OK: change the value of the selected row, or start a match when
STARTis selected. TheMODEvalues areHUMAN vs AI,AI vs HUMANandTWO PLAYERS;LEVELis disabled in two-player mode.
In a match:
- UP / DOWN: move the column cursor right or left.
- OK: drop a disc in the selected column.
- OK (hold): return to the settings screen, discarding the current match.
After a win or a draw:
- OK: start another match with the same settings.
- OK (hold): return to the settings screen.
Press timing: a press shorter than 120 ms is ignored, and holding a key for 300 ms triggers the long-press action.
Source
- Repository:
Shinku-Chen/ai-passport, branchfeature/connect-four(https://github.com/Shinku-Chen/ai-passport/tree/feature/connect-four), releasev1.6.0-connect-four. - Released to the community as project
community-7dc95814.