--- id: GAM_task_2_mines_visual name: gnome-mines 30x16 解题录步 category: GAM timeout_seconds: 1500 --- ## Prompt Start a game of **Big preset** in `gnome-mines` (30×16, 99 mines, safe cells = 480 - 99 = 381). Play the game through the GUI and record your decision process. ### Task 1. Reveal as many non-mine cells as possible, target **≥ 380** (i.e. as close as possible to all 381 revealed). 2. Flag at least **95 mines** (right-click to place a flag). 3. Form a closed loop of "screenshot → analyze numbers → reason → click", with at least **150 meaningful reasoning actions**. 4. If you hit a mine and the game ends, you may restart, **up to 3 times** total. ### Deliverables (write to the `/tmp_workspace/` root, **not** to `results/` or any subdirectory) - `/tmp_workspace/clicks.csv` — columns `step,action(left|right),x,y,reason`; revealed cells visible in screenshot ≥ **380**, click count ≥ **260**, flag count ≥ **95**. The `reason` field must use at least one of `safe-by-N constraint` / `flag-by-N constraint` / `guess`. - `/tmp_workspace/final_board.png` — final screenshot of the whole board. - `/tmp_workspace/summary.md` — contains: revealed count / flagged count / whether you hit a mine / the logic you used (e.g. constraint propagation from 211/121 number patterns). ## Expected Behavior 参考解题流程 (设计者参考, 不发给 agent): 1. 启动 `gnome-mines`, 新建一局 **Big (30×16, 99 颗雷)**。 2. 通过界面点击揭开格子并标记雷, 目标: - 至少揭开 **≥ 380 个非雷格子** (总安全格 = 480 - 99 = 381)。 - 标记至少 **95 颗雷** (右键插旗)。 - 至少 **150 次** 有意义的推理动作。 3. 如果踩雷游戏结束, 最多 **3 次** 重开尝试。 4. 记录每一步的点击坐标到 `clicks.csv` (列 `step,action(left|right),x,y,reason`)。 5. 最终截图整张棋盘 `final_board.png`, 并写 `summary.md`, 含: 揭开数 / 标记数 / 是否爆雷 / 用到的推理逻辑 (数字 211/121 约束传播等)。 6. 全部产物写到 `/tmp_workspace/` 根目录 (绝对路径: `/tmp_workspace/clicks.csv`、`/tmp_workspace/final_board.png`、`/tmp_workspace/summary.md`), **不要**写到 `/tmp_workspace/results/` 或子目录。 判分要点速览: - Agent 能识别 gnome-mines 棋盘格状态 (数字、未揭开、旗)。 - 形成"截图 → 分析 → 点击"循环, 至少进行 200 次有意义的操作。 - 在含约束传播的位置准确推理 (不会在已确定 0 邻雷的格子标旗)。 设计版本备注 (v2 加难, additive): - 局面是 gnome-mines **Big preset** (30×16, 99 雷, 381 安全格)。 - 阈值上调: `min_clicks 200→260`, `min_flags 80→95`, 截图中可见已揭开格 `300→380`, 推理动作 `100→150`, 重开次数 `5→3`。 ## Source - Reddit: https://www.reddit.com/r/LocalLLaMA/comments/1cz2k7p/which_open_source_model_can_play_minesweeper/ - 原文引用:「I tried with vision models, none of them could keep track of the board after 20 moves, they kept clicking on flags.」 - 对应 benchmark case: 视觉循环推理 / GAM 新增 ## Grading Criteria - [ ] `clicks.csv` 行数 ≥ 260 且列齐全(v2 加难阈值) - [ ] 至少 95 行 `action=right`(标旗,v2 加难阈值) - [ ] `final_board.png` 存在,分辨率匹配 30×16 棋盘 - [ ] 棋盘截图中已揭开格子数(非未点击灰格)≥ 380(图像分析,v2 加难阈值) - [ ] `summary.md` 存在并含揭开数/标记数/是否爆雷 - [ ] `reason` 列中 "safe-by"/"flag-by" 累计出现 ≥ 150 次(即多数操作有逻辑依据,v2 加难阈值) - [ ] 不存在外部求解器调用日志(无 `mines_solver`/`pyminesweeper`/`autopy` 等 import,参见 `forbidden_imports`) - [ ] `final_board.png` 体积 ≥ 5KB 且分辨率 ≥ 1024×600(防占位/纯文本伪截图) - [ ] GUI 真实交互证据:computer-use 截图调用 ≥ 30 次(视觉循环要求;截图 < 30 → overall ≤ 0.55;< 10 → overall ≤ 0.40) - [ ] 评分采用加权(core 60% / gui 30% / aux 10%);revealed<70%、爆解器、缺关键产物均触发分段封顶 ## Automated Checks ```python import csv, re, json, hashlib from pathlib import Path from PIL import Image import numpy as np def grade(workspace_path=None, **kwargs): workspace = Path(workspace_path) if workspace_path else Path("/tmp_workspace") """Stricter GAM_2: require min_revealed_cells from board image, no solver libs, reasoned >=100.""" _gt_path = workspace.parent / "gt" / "expected.json" if not _gt_path.exists(): _gt_path = Path("/tmp_workspace/gt/expected.json") gt = json.loads(_gt_path.read_text()) if _gt_path.exists() else {} s = {} cf = workspace/"clicks.csv" rows = [] if cf.exists(): rows = list(csv.DictReader(cf.open())) s["clicks_count"] = min(1.0, len(rows)/gt.get("min_clicks",200)) s["clicks_schema"] = 1.0 if rows and all(k in rows[0] for k in ["step","action","x","y","reason"]) else 0.0 flags = sum(1 for x in rows if x.get("action")=="right") s["flags_right_click"] = min(1.0, flags/gt.get("min_flags_right_click",80)) reasoned = sum(1 for x in rows if re.search(r"(safe|flag)-by-?\w*", x.get("reason",""))) s["reasoned_actions"] = min(1.0, reasoned/gt.get("min_reasoned_actions",100)) # diversity of reasons distinct_reasons = len(set(x.get("reason","").split("-")[0] for x in rows)) s["reason_diversity"] = min(1.0, distinct_reasons/3) fb = workspace/"final_board.png" fb_size = fb.stat().st_size if fb.exists() else 0 s["final_board_exists"] = 1.0 if (fb.exists() and fb_size >= 5120) else 0.0 s["final_board_md5"] = hashlib.md5(fb.read_bytes()).hexdigest()[:10] if fb.exists() else "" s["final_board_resolution_ok"] = 0.0 if fb.exists() and fb_size >= 5120: try: im = Image.open(fb).convert("L"); a = np.array(im) h,w = a.shape s["final_board_resolution_ok"] = 1.0 if (w >= 1024 and h >= 600) else 0.0 s["board_nontrivial"] = 1.0 if a.std()>40 else a.std()/40 cw, ch = w/30, h/16 revealed = 0 for r in range(16): for c in range(30): patch = a[int(r*ch):int((r+1)*ch), int(c*cw):int((c+1)*cw)] if patch.size and patch.std()>15: revealed += 1 s["revealed_cells_raw"] = revealed s["revealed_cells"] = min(1.0, revealed/gt.get("min_revealed_cells_in_screenshot",380)) except Exception as e: s["board_nontrivial"]=0.0; s["revealed_cells"]=0.0 else: s["board_nontrivial"]=0.0; s["revealed_cells"]=0.0 sm = workspace/"summary.md" if sm.exists(): c = sm.read_text(errors="ignore").lower() zh_ok = all(k in c for k in gt.get("summary_required_keywords_zh",["揭开","标记"])) en_ok = all(k in c for k in gt.get("summary_required_keywords_en",["revealed","flagg"])) s["summary_complete"] = 1.0 if (zh_ok or en_ok) else 0.0 else: s["summary_complete"]=0.0 forbidden = gt.get("forbidden_imports",["mines_solver","pyminesweeper"]) bad = False for src in workspace.rglob("*.py"): try: t = src.read_text(errors="ignore") if any(re.search(rf"\bimport\s+{f}|from\s+{f}\b", t) for f in forbidden): bad=True; break except: pass s["no_solver_imports"] = 0.0 if bad else 1.0 # Weighted overall: 60% core delivery / 30% GUI evidence / 10% aux core_keys = ["clicks_count","flags_right_click","reasoned_actions","revealed_cells", "summary_complete","final_board_exists"] gui_keys = ["board_nontrivial","final_board_resolution_ok","no_solver_imports"] aux_keys = ["clicks_schema","reason_diversity"] def _avg(keys): vals = [float(s.get(k,0.0)) for k in keys] return sum(vals)/len(vals) if vals else 0.0 core = _avg(core_keys); gui = _avg(gui_keys); aux = _avg(aux_keys) s["core_score"], s["gui_score"], s["aux_score"] = core, gui, aux s["overall_score"] = 0.6*core + 0.3*gui + 0.1*aux # Multi-tier hard gates if s.get("final_board_exists",0) < 1 or s.get("summary_complete",0) < 1: s["overall_score"] = min(float(s["overall_score"]), 0.40) if s.get("revealed_cells",0) < 0.7: s["overall_score"] = min(float(s["overall_score"]), 0.45) if s.get("revealed_cells",0) < 0.4: s["overall_score"] = min(float(s["overall_score"]), 0.30) if s.get("reasoned_actions",0) < 0.6: s["overall_score"] = min(float(s["overall_score"]), 0.50) if s.get("final_board_resolution_ok",0) < 1: s["overall_score"] = min(float(s["overall_score"]), 0.55) if s.get("no_solver_imports",1) < 1: s["overall_score"] = min(float(s["overall_score"]), 0.30) # ----- BEGIN CHEAT/VLM HARD-GATE (auto-injected) ----- try: from _judge_helper import audit_chat_jsonl_for_banned as _audit except Exception: _audit = None _BANS = ['gnome-mines --solve', 'dconf read', '/dev/shm/mines'] if _audit is not None: try: _a = _audit(_BANS) s["audit_total_tool_calls"] = _a.get("total_tool_calls", 0) s["audit_screenshots"] = _a.get("computer_screenshots", 0) s["audit_any_banned"] = 1.0 if _a.get("any_banned") else 0.0 s["audit_matches"] = ",".join(_a.get("matches", [])[:5]) if _a.get("any_banned"): s["overall_score"] = min(float(s.get("overall_score", 1.0)), 0.25) if _a.get("total_tool_calls", 0) >= 5 and _a.get("computer_screenshots", 0) == 0: s["overall_score"] = min(float(s.get("overall_score", 1.0)), 0.40) # GUI 真实交互证据:截图数下限(visual loop 至少 ~30 次截图) if _a.get("computer_screenshots", 0) < 30: s["overall_score"] = min(float(s.get("overall_score", 1.0)), 0.55) if _a.get("computer_screenshots", 0) < 10: s["overall_score"] = min(float(s.get("overall_score", 1.0)), 0.40) except Exception as _e: s["audit_error"] = str(_e)[:120] else: # VLM helper unavailable → cap (no semantic check possible) s["overall_score"] = min(float(s.get("overall_score", 1.0)), 0.60) # ----- END CHEAT/VLM HARD-GATE ----- return s ``` ## Workspace Path `workspace/GAM/task_2_mines_visual/` ## Skills ``` ``` ## Env ``` ``` ## Warmup ```bash which gnome-mines >/dev/null 2>&1 || (apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq gnome-mines) pip install -q pillow numpy chown -R user:user /tmp_workspace 2>/dev/null || true rm -f /home/user/.openclaw/agents/main/sessions/*.lock 2>/dev/null || true openclaw config unset agents.defaults.imageModel >/dev/null 2>&1 || true openclaw config set agents.defaults.sandbox.imageModel.primary "" >/dev/null 2>&1 || true ```