feat(saolei): 交互玩扫雷每一步自动出 PNG

- play_saolei.tcl: k 每执行一个按键动作就存 shots/NNN_<按键>.png,并覆盖
  shots/latest.png(在 VS Code 里开着 latest.png 即可每步自动刷新);新增 view 命令
- fb2png.py: 新增 --quiet(只写 PNG 不打印,供脚本批量截图)
- tb_saolei*.v: 仅格式调整(case 分支拆行),无语义变化
实测:k cuuuuc -> shots/001_c.png ... 006_c.png,每张 640x480 正常
This commit is contained in:
2026-09-19 20:01:28 +08:00
parent 132c9202f6
commit 713ee99941
4 changed files with 113 additions and 38 deletions
+7
View File
@@ -4,6 +4,7 @@
用法:
py saolei/tools/fb2png.py <dump.txt> [输出.png]
py saolei/tools/fb2png.py --term <dump.txt> # 只在终端打印彩色棋盘(交互玩扫雷用)
py saolei/tools/fb2png.py --quiet <dump.txt> [输出.png] # 只写 PNG,不打印任何东西
dump 格式(tb_saolei.v 里的 dump_fb 任务生成):
CURSOR <row> <col>
@@ -158,8 +159,14 @@ def draw_term(fb, cur, cursor_box, note=""):
def main():
args = list(sys.argv[1:])
term_only = "--term" in args
quiet = "--quiet" in args
if term_only:
args.remove("--term")
if quiet:
args.remove("--quiet")
if quiet: # 只出图不说话(给脚本批量截图用)
import os
sys.stdout = open(os.devnull, "w")
if not args:
raise SystemExit(__doc__)
src = args[0]