chemaclass/phel-flappybird
Composer 安装命令:
composer create-project chemaclass/phel-flappybird
包简介
Flappy Bird in your terminal — a CLI game written in Phel (Lisp on PHP).
README 文档
README
A CLI Flappy Bird written in Phel (a Lisp that compiles to PHP). Flap through scrolling pipes in your terminal.
+----------------------------------------------------------+
| ### |
| ### |
| |
| @ |
| ### |
| ### |
+----------------------------------------------------------+
Score: 3 High: 7 (space/up = flap, q = quit)
Play
From a release PHAR (needs only PHP 8.4+):
# download phel-flappybird.phar from the Releases page, then:
php phel-flappybird.phar
From source:
composer install composer dev # run straight from source # or compile an entry point and run it: composer start # = composer build && composer play
Controls
| Key | Action |
|---|---|
space / ↑ |
flap |
q |
quit |
r |
replay (game over) |
Options
Pass key=value arguments to tune the game:
php phel-flappybird.phar width=80 height=30 gap=8 gravity=0.25
| Option | Default | Meaning |
|---|---|---|
width=N |
60 | board width |
height=N |
22 | board height |
gap=N |
6 | pipe gap height |
spacing=N |
22 | columns between pipes |
gravity=F |
0.20 | downward acceleration / tick |
flap=F |
-0.95 | velocity applied on a flap |
delay=N |
90000 | tick delay in microseconds |
debug |
off | physics overlay |
--version and --help print info and exit.
Your best score is saved to ~/.phel-flappybird-highscore.
Architecture
Functional core / imperative shell:
src/core/physics.phel— pure. The whole game is one immutable world map ({:bird :pipes :score :dead?}) advanced by a singlestepreducer. Randomness is injected by the caller, sostepis deterministic and fully unit-tested.src/core/render.phel,src/core/input.phel— the effectful edges (terminal drawing viaphel-cli-gui, keyboard reading).src/game.phel— the loop: read input →step→ render → sleep → repeat.
Development
composer test # run the phel test suite composer format # format src + tests composer build # compile to out/ composer phar # build build/out/phel-flappybird.phar composer ci # format-check + test + build
Releasing
./tools/release.sh 0.1.0 # validate, build+smoke-test PHAR, tag, GH release ./tools/release.sh --dry-run # preview without changing anything
License
MIT
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-14