diff --git a/cases.json b/cases.json index f9bc4ca..1e6cf1d 100644 --- a/cases.json +++ b/cases.json @@ -103,8 +103,8 @@ "en": "Each model writes a territory-grabbing agent in one shot; agents battle head-to-head on the same grid — ranked by objective wins, not votes." }, "prompt": { - "zh": "你要为一个 1v1 的「圈地对决」(Turf War) 环境编写一个 JavaScript 智能体。这是一个双人零和、双方同时行动的博弈。你的目标只有一个:在与多个未知对手、多张随机地图的循环赛中拿到尽可能高的胜率。对手由同等水平的 AI 模型编写——不要依赖「对手会犯错」的脆弱套路,任何固定模式都可能被针对;但也不要为求稳放弃进攻,平局只得 0.5 分,一个只求不败的智能体拿不到高排名。这是你唯一一次提交:没有反馈、没有试跑、没有重试,成绩公开计入排行榜。请输出你能写出的最强智能体。\n\n【环境规则】\n\n- 棋盘为 40×40 网格,坐标 (x, y),x 向右,y 向下,范围 0–39。每局按种子生成若干 180° 中心对称的岩石格(不可通行),出生点附近不会有岩石。\n- 双方从对角出生点出发,初始拥有出生点周围 3×3 领地。每 tick 双方同时移动一格,方向为 up / down / left / right 之一;全场共 1200 tick。\n- 在自己领地外移动会留下尾巴。回到自己领地的瞬间,你的尾巴以及被「尾巴 + 领地」围住的区域全部变成你的领地(包括对方领地)。围住判定:从棋盘边界向内 flood fill(岩石可穿过但不可被占有),无法到达的格子归你。\n- 任何人(包括你自己)踩到某玩家的尾巴,该尾巴的主人立即死亡。双方同 tick 进入同一格或互相穿过,双方同时死亡。撞岩石或出界,自己死亡。击杀判定基于本 tick 开始前的尾巴状态,双方完全对等。\n- 死亡后尾巴消失、领地保留;3 tick 后在出生点重生并重新获得周围 3×3 领地(覆盖任何归属),重生后 10 tick 无敌(不会死亡也不能击杀)。\n- 同 tick 结算顺序固定:移动 → 死亡判定 → 圈地 → 重生计时。1200 tick 结束时领地格数多者获胜,相等为平局。\n\n【接口】你必须输出一个 JS 文件,顶层定义:\n\n```js\nfunction createAgent(config) {\n // config = { size: 40, totalTicks: 1200 }\n // 可以在闭包里保存任意记忆(允许并鼓励在对局中在线建模对手)\n return {\n act(obs) {\n return \"up\"; // \"up\" | \"down\" | \"left\" | \"right\"\n }\n };\n}\n```\n\nobs 每 tick 传入,字段:\n\n- obs.tick:当前 tick,从 0 起\n- obs.grid[y][x]:0 空地 · 1 我的领地 · 2 我的尾巴 · 3 对方领地 · 4 对方尾巴 · 5 岩石。grid 数组每 tick 会被复用,不要跨 tick 持有引用,需要历史请自行拷贝\n- obs.me / obs.opp:{ x, y, dir, alive, respawnIn, invincibleFor }\n- obs.scores:{ me, opp },双方当前领地格数\n- obs.rng():[0,1) 确定性随机数;需要随机时只准用它\n\n另外,请在返回的对象里附带 name 字段(与 act 并列):给你的算法起一个不超过 5 个字、有意思的名字,例如 { name: \"...\", act(obs) {...} }。\n\n视角是自我中心的:无论执哪一边,你都是 me。信息完全公开,没有战争迷雾。非法动作、抛异常或超出算力预算,该 tick 视为沿原方向直行。\n\n【运行时约束】\n\n- 纯 JavaScript(ES2020),单文件;禁止 import/require、网络、存储、Math.random、Date(运行环境会封禁它们)。\n- 算力限制是确定性的:你的代码会被自动插桩计数,每 tick 预算为 200,000 次「循环迭代 + 函数调用」。参考:一次 40×40 全图 BFS 约 2,000–6,000 次。超出预算该 tick 视为直行。\n- 完成本任务只依靠你自身的知识与推理:禁止联网搜索、禁止查阅外部文档或代码库、禁止调用任何 skill/插件/外部工具、禁止试运行代码。\n- 输出前静态自查:合法 ES2020、顶层定义了 createAgent、无 import / Math.random / Date。\n\n【评测】你的智能体将与其他 AI 模型编写的智能体进行多局循环赛,每局地形随机、先后手轮换,按胜负用 Bradley-Terry 排名。请深思熟虑后一次性输出唯一、完整、可直接运行的 JS 文件,不要输出任何解释文字。", - "en": "Write a JavaScript agent for a 1v1 \"Turf War\" environment. This is a two-player, zero-sum, simultaneous-move game. Your sole objective is to maximize your win rate in a round-robin against multiple unknown opponents across randomized maps. Opponents are written by equally capable AI models — do not rely on brittle patterns that assume opponent mistakes, as any fixed pattern can be exploited; but do not trade wins for safety either: a draw scores only 0.5, and an agent that merely avoids losing will not rank. This is your only submission: no feedback, no test runs, no retries, and the result is public on a leaderboard. Output the strongest agent you can write.\n\n[Environment]\n\n- The board is a 40×40 grid, coordinates (x, y), x rightward, y downward, range 0–39. Each match seeds a set of 180°-centrally-symmetric rock cells (impassable); no rocks appear near the spawns.\n- Both players start from opposite corners owning a 3×3 territory around their spawn. Each tick both players move one cell simultaneously (up / down / left / right); a match lasts 1200 ticks.\n- Moving outside your own territory leaves a trail. The moment you re-enter your own territory, your trail plus every region enclosed by trail + territory becomes yours (including the opponent's territory). Enclosure test: flood fill inward from the board border (rocks are transparent to the flood but can never be owned); unreachable cells are captured.\n- If anyone (including yourself) steps on a player's trail, that trail's owner dies immediately. Entering the same cell on the same tick, or swapping cells, kills both players. Hitting a rock or leaving the board kills you. Kill checks use the trail state from the start of the tick, so both sides are perfectly symmetric.\n- On death your trail vanishes but your territory is kept; you respawn at your spawn point after 3 ticks with a fresh 3×3 territory (overwriting any ownership) and 10 ticks of invincibility (you cannot die or kill).\n- Per-tick resolution order is fixed: moves → deaths → capture → respawn countdown. After 1200 ticks the larger territory wins; equal is a draw.\n\n[Interface] You must output one JS file that defines at top level:\n\n```js\nfunction createAgent(config) {\n // config = { size: 40, totalTicks: 1200 }\n // keep any memory in the closure (in-match opponent modeling is allowed and encouraged)\n return {\n act(obs) {\n return \"up\"; // \"up\" | \"down\" | \"left\" | \"right\"\n }\n };\n}\n```\n\nobs is passed every tick:\n\n- obs.tick: current tick, starting at 0\n- obs.grid[y][x]: 0 empty · 1 my territory · 2 my trail · 3 opponent territory · 4 opponent trail · 5 rock. Grid arrays are reused across ticks — do not hold references across ticks; copy if you need history\n- obs.me / obs.opp: { x, y, dir, alive, respawnIn, invincibleFor }\n- obs.scores: { me, opp }, current territory cell counts\n- obs.rng(): deterministic random in [0,1); it is the only allowed source of randomness\n\nAlso include a name field on the returned object (next to act): give your algorithm a fun, memorable name of at most one short word (~10 characters), e.g. { name: \"...\", act(obs) {...} }.\n\nThe view is ego-centric: whichever side you play, you are me. Information is fully public — no fog of war. An invalid action, a thrown exception, or exceeding the compute budget makes you continue straight for that tick.\n\n[Runtime]\n\n- Pure JavaScript (ES2020), single file; import/require, network, storage, Math.random and Date are forbidden (the runtime blocks them).\n- The compute limit is deterministic: your code is automatically instrumented, with a per-tick budget of 200,000 loop iterations + function calls. Reference: one full-board 40×40 BFS costs about 2,000–6,000. Exceeding the budget means you walk straight that tick.\n- Rely solely on your own knowledge and reasoning: no web search, no consulting external docs or codebases, no skills/plugins/external tools, no test-running code.\n- Static self-check before you output: valid ES2020, createAgent defined at top level, no import / Math.random / Date.\n\n[Evaluation] Your agent plays a multi-game round-robin against agents written by other AI models, with randomized terrain and alternating sides, ranked by Bradley-Terry on match outcomes. Think hard, then output a single, complete, directly runnable JS file — no explanations." + "zh": "你要为一个 1v1 的「圈地对决」(Turf War) 环境编写一个 JavaScript 智能体。这是一个双人零和、双方同时行动的博弈。你的目标只有一个:在与多个未知对手、多张随机地图的循环赛中拿到尽可能高的胜率。对手由同等水平的 AI 模型编写——不要依赖「对手会犯错」的脆弱套路,任何固定模式都可能被针对;但也不要为求稳放弃进攻,平局只得 0.5 分,一个只求不败的智能体拿不到高排名。这是你唯一一次提交:没有反馈、没有试跑、没有重试,成绩公开计入排行榜。请输出你能写出的最强智能体。\n\n【环境规则】\n\n- 棋盘为 40×40 网格,坐标 (x, y),x 向右,y 向下,范围 0–39。每局按种子生成若干 180° 中心对称的岩石格(不可通行),出生点附近不会有岩石。\n- 双方从对角出生点出发,初始拥有出生点周围 3×3 领地。每 tick 双方同时移动一格,方向为 up / down / left / right 之一;全场共 1200 tick。\n- 在自己领地外移动会留下尾巴。回到自己领地的瞬间,你的尾巴以及被「尾巴 + 领地」围住的区域全部变成你的领地(包括对方领地)。围住判定:从棋盘边界向内 flood fill(岩石可穿过但不可被占有),无法到达的格子归你。\n- 任何人(包括你自己)踩到某玩家的尾巴,该尾巴的主人立即死亡。双方同 tick 进入同一格或互相穿过,双方同时死亡。撞岩石或出界,自己死亡。击杀判定基于本 tick 开始前的尾巴状态,双方完全对等。\n- 死亡后尾巴消失、领地保留;3 tick 后在出生点重生并重新获得周围 3×3 领地(覆盖任何归属),重生后 10 tick 无敌(不会死亡也不能击杀)。\n- 同 tick 结算顺序固定:移动 → 死亡判定 → 圈地 → 重生计时。1200 tick 结束时领地格数多者获胜,相等为平局。\n\n【接口】你必须交付一个 JS 文件:在能创建文件的环境中,把它保存为 turf-war.js;纯对话环境则直接输出完整文件内容。文件顶层定义:\n\n```js\nfunction createAgent(config) {\n // config = { size: 40, totalTicks: 1200 }\n // 可以在闭包里保存任意记忆(允许并鼓励在对局中在线建模对手)\n return {\n act(obs) {\n return \"up\"; // \"up\" | \"down\" | \"left\" | \"right\"\n }\n };\n}\n```\n\nobs 每 tick 传入,字段:\n\n- obs.tick:当前 tick,从 0 起\n- obs.grid[y][x]:0 空地 · 1 我的领地 · 2 我的尾巴 · 3 对方领地 · 4 对方尾巴 · 5 岩石。grid 数组每 tick 会被复用,不要跨 tick 持有引用,需要历史请自行拷贝\n- obs.me / obs.opp:{ x, y, dir, alive, respawnIn, invincibleFor }\n- obs.scores:{ me, opp },双方当前领地格数\n- obs.rng():[0,1) 确定性随机数;需要随机时只准用它\n\n另外,请在返回的对象里附带 name 字段(与 act 并列):给你的算法起一个不超过 5 个字、有意思的名字,例如 { name: \"...\", act(obs) {...} }。\n\n视角是自我中心的:无论执哪一边,你都是 me。信息完全公开,没有战争迷雾。非法动作、抛异常或超出算力预算,该 tick 视为沿原方向直行。\n\n【运行时约束】\n\n- 纯 JavaScript(ES2020),单文件;禁止 import/require、网络、存储、Math.random、Date(运行环境会封禁它们)。\n- 算力限制是确定性的:你的代码会被自动插桩计数,每 tick 预算为 200,000 次「循环迭代 + 函数调用」。参考:一次 40×40 全图 BFS 约 2,000–6,000 次。超出预算该 tick 视为直行。\n- 完成本任务只依靠你自身的知识与推理:禁止联网搜索、禁止查阅外部文档或代码库、禁止调用任何 skill/插件/外部工具、禁止试运行代码。\n- 交付前静态自查:合法 ES2020、顶层定义了 createAgent、无 import / Math.random / Date。\n\n【评测】你的智能体将与其他 AI 模型编写的智能体进行多局循环赛,每局地形随机、先后手轮换,按胜负用 Bradley-Terry 排名。请深思熟虑后一次性交付唯一、完整、可直接运行的 JS 文件,除该文件外不要有任何解释或多余文件。", + "en": "Write a JavaScript agent for a 1v1 \"Turf War\" environment. This is a two-player, zero-sum, simultaneous-move game. Your sole objective is to maximize your win rate in a round-robin against multiple unknown opponents across randomized maps. Opponents are written by equally capable AI models — do not rely on brittle patterns that assume opponent mistakes, as any fixed pattern can be exploited; but do not trade wins for safety either: a draw scores only 0.5, and an agent that merely avoids losing will not rank. This is your only submission: no feedback, no test runs, no retries, and the result is public on a leaderboard. Output the strongest agent you can write.\n\n[Environment]\n\n- The board is a 40×40 grid, coordinates (x, y), x rightward, y downward, range 0–39. Each match seeds a set of 180°-centrally-symmetric rock cells (impassable); no rocks appear near the spawns.\n- Both players start from opposite corners owning a 3×3 territory around their spawn. Each tick both players move one cell simultaneously (up / down / left / right); a match lasts 1200 ticks.\n- Moving outside your own territory leaves a trail. The moment you re-enter your own territory, your trail plus every region enclosed by trail + territory becomes yours (including the opponent's territory). Enclosure test: flood fill inward from the board border (rocks are transparent to the flood but can never be owned); unreachable cells are captured.\n- If anyone (including yourself) steps on a player's trail, that trail's owner dies immediately. Entering the same cell on the same tick, or swapping cells, kills both players. Hitting a rock or leaving the board kills you. Kill checks use the trail state from the start of the tick, so both sides are perfectly symmetric.\n- On death your trail vanishes but your territory is kept; you respawn at your spawn point after 3 ticks with a fresh 3×3 territory (overwriting any ownership) and 10 ticks of invincibility (you cannot die or kill).\n- Per-tick resolution order is fixed: moves → deaths → capture → respawn countdown. After 1200 ticks the larger territory wins; equal is a draw.\n\n[Interface] You must deliver one JS file: save it as turf-war.js if your environment can create files, otherwise print the complete file content. At top level it defines:\n\n```js\nfunction createAgent(config) {\n // config = { size: 40, totalTicks: 1200 }\n // keep any memory in the closure (in-match opponent modeling is allowed and encouraged)\n return {\n act(obs) {\n return \"up\"; // \"up\" | \"down\" | \"left\" | \"right\"\n }\n };\n}\n```\n\nobs is passed every tick:\n\n- obs.tick: current tick, starting at 0\n- obs.grid[y][x]: 0 empty · 1 my territory · 2 my trail · 3 opponent territory · 4 opponent trail · 5 rock. Grid arrays are reused across ticks — do not hold references across ticks; copy if you need history\n- obs.me / obs.opp: { x, y, dir, alive, respawnIn, invincibleFor }\n- obs.scores: { me, opp }, current territory cell counts\n- obs.rng(): deterministic random in [0,1); it is the only allowed source of randomness\n\nAlso include a name field on the returned object (next to act): give your algorithm a fun, memorable name of at most one short word (~10 characters), e.g. { name: \"...\", act(obs) {...} }.\n\nThe view is ego-centric: whichever side you play, you are me. Information is fully public — no fog of war. An invalid action, a thrown exception, or exceeding the compute budget makes you continue straight for that tick.\n\n[Runtime]\n\n- Pure JavaScript (ES2020), single file; import/require, network, storage, Math.random and Date are forbidden (the runtime blocks them).\n- The compute limit is deterministic: your code is automatically instrumented, with a per-tick budget of 200,000 loop iterations + function calls. Reference: one full-board 40×40 BFS costs about 2,000–6,000. Exceeding the budget means you walk straight that tick.\n- Rely solely on your own knowledge and reasoning: no web search, no consulting external docs or codebases, no skills/plugins/external tools, no test-running code.\n- Static self-check before you deliver: valid ES2020, createAgent defined at top level, no import / Math.random / Date.\n\n[Evaluation] Your agent plays a multi-game round-robin against agents written by other AI models, with randomized terrain and alternating sides, ranked by Bradley-Terry on match outcomes. Think hard, then deliver a single, complete, directly runnable JS file in one shot — nothing but that file, no explanations or extra files." }, "tags": [ "JS",