dsh-agent-arcade
其他 活跃维护

dsh-agent-arcade

fff122/dsh-agent-arcade

提供面向AI智能体的确定性贪吃蛇游戏运行环境,全程无随机变量干扰,所有游戏行为可完全复现,方便开发者验证不同算法训练的蛇形智能体的决策效果,支持快速接入调试。

1
Stars 标星
0
Forks 分支
1
Watchers 关注
0
Open Issues
TypeScript
主要语言
MIT
开源协议
19 KB
仓库大小
1 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:fff122/dsh-agent-arcade
git clone https://github.com/fff122/dsh-agent-arcade.git
git clone git@github.com:fff122/dsh-agent-arcade.git
README.md main

dsh-agent-arcade

A small deterministic Snake game for DeepSeek Harness. The Agent chooses a direction on every turn, while the user can watch the ASCII board, score, status, and reasoning returned by each step.

The game runs entirely in memory. It does not use the network, save files, or execute shell commands. A fixed seed makes food placement and a replayed sequence reproducible.

Quick install

Requirements

You need Node.js 22 or newer, pnpm, and a DeepSeek Harness installation that supports JavaScript or TypeScript plugins.

Step 1: Download and build

Copy and run:

git clone https://github.com/fff122/dsh-agent-arcade.git
cd dsh-agent-arcade
pnpm install
pnpm build

Step 2: Create the plugin configuration

Run this command from the repository root:

cat > agent-arcade.patch.yml <<EOF
- insert:
    - id: dsh-agent-arcade
      name: '$PWD/dist/src/index.js'
EOF

The plugin path is absolute because the Harness patch loader requires an absolute path.

Step 3: Start Harness with the plugin

If Harness is installed as a command:

dsh web --patch "$PWD/agent-arcade.patch.yml"

Otherwise, run:

npx @deepseek-ai/dsh web --patch "$PWD/agent-arcade.patch.yml"

Verify the installation

Ask the Agent:

开始一局 12×8 的贪吃蛇,随机种子用 42。每一步都告诉我棋盘、分数和你的决策理由。

The Agent should call arcade_snake_new, then alternate arcade_snake_step and arcade_snake_render. Ask for arcade_snake_history at any time to review the full sequence of decisions.

Available tools

Tool Purpose
arcade_snake_new Start or restart a deterministic game with optional width, height, and seed.
arcade_snake_step Let the Agent choose a safe direction toward food and advance one turn.
arcade_snake_render Return the current board as ASCII art with score and status.
arcade_snake_history Return every turn, direction, reason, position, score, and outcome.

Board and replay rules

The board dimensions range from 5 to 30 cells in each direction. The default board is 12 by 8, and the default seed is 1. The snake starts in the center heading right. H marks the head, o marks the body, and * marks the food.

The Agent uses a simple deterministic policy: it compares legal directions by Manhattan distance to the food, then applies a stable tie-break order. The policy is intentionally easy to read and modify; it is not intended to be a competitive game-playing algorithm.

To reproduce a run, call arcade_snake_new with the same dimensions and seed, then replay the same manual directions. A game ends when the snake hits a wall or itself, or when the board is filled.

Updating the plugin

From the cloned repository:

git pull
pnpm install
pnpm build

Restart Harness with the same patch command after rebuilding.

Development

Run the complete package quality gate from the repository root:

pnpm run format:check
pnpm run typecheck
pnpm run test
pnpm run build

The implementation is split into small modules:

src/
  index.ts       # Harness entry point and tool registration
  snake-game.ts  # Deterministic game rules, policy, rendering, and history

test/
  index.test.ts
  mount.test.ts
  snake-game.test.ts

For the plugin model and patch overlay format, see the official DeepSeek Harness plugin guide.