ICFP Programming Contest 2026 公式の littleman.wasm を Node.js から実行する
CLI。公式 Web runner の load、round、expected output、Display frame、verdict
処理を再現する。さらに、公式 Web runner が通常の JSON.parse で失う
2^53 超の int64 は decimal string として保持し、誤判定を避ける。
- Node.js 18 以上
- 初回のみ
littleman.wasmの download にネットワーク接続が必要
WASM は https://icfpcontest2026.com/littleman.wasm から自動取得され、
.gitignore 対象となる。
コンテスト中に WASM が更新されることが実際に確認されている。更新後は
sha256sum littleman.wasm と npm test の結果を記録すること。
./littleman.js -i "50" test_io2.man
# 100
echo "35" | ./littleman.js test_io2.man
# 70expected output を指定すると公式 Web runner と同じ streaming judge を使う。
正解を出し終えたプログラムは、halt していなくても outputSettled で合格する。
./littleman.js -i "50" -e "100" test_io2.man
# stdout: 100
# stderr: PASS after 7 ticksinput と expected の / が round 境界。round 1 の expected output が揃うまで
round 2 の input は WASM 内部で保留される。
./littleman.js \
-i "1 / 2 / 3" \
-e "1 / 2 / 3" \
program.man--frames は round → frames → rows の 3 重配列を持つ JSON file を取る。
各 row は色 0–15 を hexadecimal 文字 0–f で表す。
[
[
["0000", "0ff0", "0ff0", "0000"],
["1111", "1111", "1111", "1111"]
]
]./littleman.js --frames expected-frames.json display.manWASM の frameJudge を使用するため、最初の誤 frame、不足 frame、余分な通常
output を区別できる。
公開 problem detail を保存する。
curl https://icfpcontest2026.com/api/v1/public/problems/triangle \
-o triangle.json
./littleman.js --test-data triangle.json triangle.man
./littleman.js --test-data triangle.json --case four triangle.man
./littleman.js --test-data triangle.json --case 3 triangle.manpublicTestData の単一 round、複数 round、Display frame を自動変換する。
--case の番号は 1-based。tickCap が problem JSON にあれば使用し、なければ
5,000,000 tick。
Run mode:
-i, --input <values> Input。"/" は round 境界
-e, --expected <values> Expected output。指定時は judge mode
-f, --frames <file> Round-grouped expected frame JSON
-l, --limit <ticks> 最大 tick(default 5,000,000)
--batch <ticks> 1 回の stepN(default 5,000)
--stop-on-frame frame commit ごとに stepN から戻る
Public-test mode:
-t, --test-data <file> Problem detail JSON の publicTestData を実行
-c, --case <name|number> 1 test だけ実行
Output/setup:
-j, --json JSON result
-v, --verbose load と全 tick snapshot
--metadata validOps と structuralGlyphs
-d, --download WASM を再取得
-h, --help
done: judge なしの実行が正常 halt。pass: expected output と全 frame が一致。fail: wrong/extra/missing output、frame mismatch。load-error: room、pipe、literal 等の load error。crash:wall,bad-op,no-pipe, Display error 等。execution-error: WASM API の structured error。timeout: tick 上限まで verdict が出ない。
終了 code は done/pass が 0、実行・判定失敗が 1、CLI usage error が 2。
npm test回帰 test は次を実際の公式 WASM で検査する。
- 従来の整数 I/O
- Web editor と同じ外側 margin crop・座標復元
- correct/wrong expected output
- structured load error と runtime
bad-op - halt しないプログラムの
outputSettled - round input の保留・解放
- Display frame の一致・不一致
- step limit
- problem-detail
publicTestData - staging 済みだが Reference 未掲載の
Yの実測動作 - int64 の WASM JSON 境界での lossless 処理
WASM 自体の再現可能な black-box probe:
npm run audit # 境界値、layout、collision、JSON 精度
npm run audit:fuzz # seed 固定の算術差分 test 1,000 件
npm run audit:deep # 65,536-runner の Y 上限(約 20 秒、メモリ消費大)詳細な reverse engineering 記録は
../aidoc/WebRunner.md と
../aidoc/WasmAudit.md を参照。
プログラム(.man ソースコード)を回転・反転させるユーティリティ transform.js が利用可能です。このツールは、部屋の内部にある算術・論理演算の - や | といった「命令」のセマンティクスを維持したまま、構造物としての壁やパイプライン(> < ^ v - |)を適切に回転・反転させます。
# 90度時計回りに回転
node transform.js rot90 input.man output.man
# 左右反転(水平反転)
node transform.js flip-x input.man output.man
# 標準入力から受け取って標準出力へ出力
cat input.man | node transform.js rot180 > output.manflip-x/flip-h: 左右反転flip-y/flip-v: 上下反転rot90/rot90cw: 90度時計回り回転rot180: 180度回転rot270/rot90ccw: 90度反時計回り回転transpose: 主対角線による転置anti-transpose: 反対角線による転置
--raw: 部屋の解析を行わず、グリッド全体の-と|を単純に入れ替えます(命令としての-/|も置換されます)。
- Little man の初期方向:
@で生成される little man は、常に東(右)を向いて開始します。プログラムを回転または反転した場合、@の周辺レイアウト(進む先が壁にならないようにするなど)をユーザー自身で調整する必要があります。 - LM-75 Display の接続: ディスプレイのポート定義(上辺 ADDR、左辺 DATA、下辺 SWAP)は VM 側で固定されています。ディスプレイ自体を回転させた場合は、パイプの接続ポートを正しく再配線する必要があります。