借路 v0.4 規則審查與公平性檢查

2026-10-28 · 依據《借路》遊戲機制 v0.4(整理日期 2026-10-26) · 回到遊戲

  • v0.4 開局後手必勝。不論哪一方先走,先走的一方在開局就已經輸了:四個合法的第一手全部會輸,對手最多 22 手內抵達旗格。這是電腦完整求解的結果,並由第二套程式獨立驗證。
  • 原因是「必須走棋」。v0.4 規定只要還有合法行動就不能跳過。開局時先走的一方只有兩種動作:把守在對方旗格旁的棋子移開,或把面前的水洞填平。前者讓出入口,後者替對方鋪路,四個選項都會削弱自己。
  • 建議修法:只移動四個水洞。把水洞從 B2、D2、B4、D4 移到 A2、E2、A4、E4,其他規則不變。新開局是理論和棋,也就是雙方都無法強迫取勝。在模擬的同等程度對局中(每步失誤率 5% 到 30%),先手勝率維持在 50% 到 53% 之間。
  • 其他規則沒有發現矛盾。「禁止立即搬回」實際生效的範圍比文字看起來窄得多,建議在文件中寫清楚。

1. 怎麼檢查的

這個遊戲的局面數量有限:4 個水洞在 23 格可搬地板上的擺法有 8,855 種,雙方棋子的位置有 23,256 種,再乘上輪到哪一方,共約 4.1 億個基本局面;把搬回限制也算進去,有效局面是 456,515,280 個。電腦從「下一步就能抵達旗格」的局面開始往回推,一層一層標出每個局面在雙方都下最好時的結果:輪到的一方會贏、會輸,或沒有人能強迫取勝(和棋)。這種做法叫逆推分析(retrograde analysis),西洋棋的殘局庫就是這樣做的。4 核心約 4 分鐘完成,最長的強制勝利是 79 手。因為表裡有所有 4 洞的地形,換一種開局也能直接查出結果。

交叉檢查

  1. 求解器自我檢查:隨機抽約 19 萬個局面,確認「往回推」和「往前走」完全互為鏡像,0 錯誤。
  2. 兩套程式對照:網頁上的規則引擎(JavaScript)和求解器(C)分開撰寫。兩者在 6,000 盤隨機長局、約 35 萬個局面上逐步比對合法走法清單,0 不一致;從開局數到第 7 手的所有走法序列(4、16、64、256、1,152、5,176、25,822)也完全相同。
  3. 獨立證明:把後手的必勝策略匯出,由 JavaScript 引擎窮舉先手的所有應對,共 12,121 個不同局面。每一條路線都在 22 手內由後手抵達旗格,途中不會出現三次重複。

2. 發現一:v0.4 開局後手必勝

先手(薄荷)第一手雙方都下最好時
B5 走到 A5珊瑚 21 手內獲勝
D5 走到 E5同上(左右對稱)
地板 A5 搬到 B4珊瑚 21 手內獲勝
地板 E5 搬到 D4同上(左右對稱)

珊瑚先走時情況完全相同,換成薄荷 22 手內獲勝。以下是一條主線(贏的一方選最快的贏法,輸的一方選撐最久的下法):

1 薄荷 B5→A52 珊瑚 地板 A1→B2 3 薄荷 A5→A44 珊瑚 B1→B2 5 薄荷 地板 E5→D46 珊瑚 B2→B3 7 薄荷 D5→D48 珊瑚 地板 E1→D2 9 薄荷 D4→C410 珊瑚 D1→D2 11 薄荷 A4→A512 珊瑚 D2→C2 13 薄荷 C4→C314 珊瑚 地板 B2→B4 15 薄荷 C3→C416 珊瑚 C2→C3 17 薄荷 A5→A418 珊瑚 B3→B4 19 薄荷 A4→A320 珊瑚 B4→B5 21 薄荷 A3→A222 珊瑚 B5→C5 抵達旗格

這不是「先手稍微吃虧」,而是在雙方都下對的前提下,結果在第一手之前就已經決定。實戰中影響也很大。模擬雙方每一步都有固定機率隨手亂走:失誤率 5%(接近高手)時後手勝 83%,15% 時後手仍勝 66%,要到 50%(近乎亂下)才接近五五波。

3. 為什麼文件原有的檢查看不出來

文件第 8、11 節很謹慎,已經提醒「先手輪替不等於證明沒有先手優勢」。實際情況比這句提醒更嚴重:原有的三種檢查,在結構上都看不到這類問題。

這不是文件寫錯,而是這類問題只有完整求解或很深的搜尋才看得出來。建議往後每次改動棋盤、開局或勝負條件,都重新跑一次求解(本頁附原始碼)。

4. 發現二:「禁止立即搬回」只在很窄的情況下生效

文件 §5.3 的寫法,容易讓人以為每次搬地板後,對手下一手都受到限制。實際上:

另外兩點:

5. 檢查過、沒有問題的部分

6. 修法比較

為什麼不用「允許跳過」或「選邊規則」

只改水洞位置

棋子仍在 B5、D5 和 B1、D1。下表列出所有左右對稱、雙方互為鏡像的 4 洞配置。勝率欄是模擬雙方同等程度對局的先手勝率,每格 20,000 局。

水洞完美對局先手勝率
失誤 5%
先手勝率
失誤 15%
先手勝率
失誤 30%
平均手數
失誤 5%
B2 D2 B4 D4(v0.4)後手 22 手內必勝17.1%33.8%43.5%20
A1 E1 A5 E5後手 18 手內必勝未模擬
A2 E2 A4 E4(建議)和棋50.3%52.2%51.9%56
C2 A3 E3 C4和棋69.5%60.1%58.8%45
C2 B3 D3 C4和棋51.4%52.8%53.2%43
A3 B3 D3 E3和棋50.5%53.1%56.0%44

建議 A2、E2、A4、E4,理由如下:

  1. 改動最小:水洞只往外移一欄,所在的列不變。
  2. 各種程度都最接近五五波。C2 A3 E3 C4 雖然理論上也是和棋,實戰卻明顯偏向先手,可見「理論和棋」不等於「實戰公平」,兩者都要檢查。
  3. 棋局最長。高手局平均 56 手,策略空間最大。
  4. 開局不是陷阱。先手往前走(B5→B4 或 D5→D4)可以守住和棋;往旁邊走理論上會輸,但要 49 手後才分勝負,實戰中不會變成新手陷阱。後手的第一步就需要計算:先手走 B5→B4 之後,珊瑚若走 B1→A1,7 手內就會輸。

次選是 C2、B3、D3、C4:同樣接近五五波,但只有一步能守和的局面更多(約 66%,A2 E2 A4 E4 約 59%),棋風更尖銳。

限制:模擬中的「失誤」是隨機亂走一步,和真人的失誤型態不同,真人試玩仍然必要。模擬沒有套用三次重複規則,只設 400 手上限(沒有任何一局撞到上限),所以真人對局的和棋比例可能較高。理論和棋代表完美對局下無人能贏,實戰勝負取決於誰先犯錯;在這個開局的和棋局面中,平均只有約 27% 的走法能守住和棋,犯錯的空間很大。

7. 建議的 v0.5 改動清單

  1. 初始水洞改為 A2、E2、A4、E4。其餘規則不變。
  2. 更新文件 §2 的表格,以及 §4、§5.1 的例子:B4 不再是水洞,開局時棋子旁邊沒有水洞,所以第一手只能走棋。
  3. §5.3 補一句限制實際生效的情況;§7.2 改成「只有會擋住某一步的搬回限制,才算進局面」。
  4. §11 補上:開局已用完整求解確認雙方都沒有必勝。往後改棋盤或開局,重跑一次求解。

8. Demo 的電腦對手

簡單:只看一步,但認得「棋子已貼在自己旗格旁=下一步必勝」。普通:三手搜尋,和 v0.4 同深度。困難:逐步加深的搜尋,每步固定 25 萬個節點上限,所以同一局面永遠得到同一步,不靠計時,也不靠隨機。

用求解結果出題測試:

難度3 到 9 手內必勝的局面,找到致勝手理論和棋、有 8 手內會輸的陷阱,成功避開
簡單292 / 300204 / 300
普通295 / 300237 / 300
困難100 / 100100 / 100

困難難度每步約 0.4 到 1.4 秒。它不是完美對手,看不到很長的計畫。

9. 重現

原始碼在本資料夾:solver.c(求解器)、replay.mjs、verify_strategy.mjs、probe_ai.mjs(和網頁引擎對照)。需要約 4 GB 記憶體與 4 GB 磁碟。

gcc -O3 -march=native -fopenmp -o solver solver.c
./solver check 200000                 # 往回推與往前走互為鏡像
./solver solve table.bin              # 完整求解,約 4 分鐘
./solver analyze table.bin            # 開局結果、主線、所有開局配置
./solver strategy table.bin coral.txt # 匯出後手必勝策略
node verify_strategy.mjs coral.txt ../engine.js
./solver dump 3000 300 > games.txt  && node replay.mjs games.txt ../engine.js
./solver survey table.bin && ./solver sim table.bin

Jielu v0.4: rules review and fairness check

2026-10-28 · based on the Jielu mechanics document v0.4 (2026-10-26) · Back to the game

  • The v0.4 opening is a win for the second player. Whichever side moves first is already lost: all four legal first moves lose, and the opponent reaches its flag within 22 moves. This comes from a full computer solve and was checked again by a second, separate program.
  • The cause is the duty to move. v0.4 does not allow a pass while any legal move exists. At the start, the first player can only move a piece that guards the other flag, or fill the water in front of it. The first opens a door, the second builds a road for the opponent. All four options hurt.
  • Suggested fix: move the four water squares, nothing else. Move them from B2, D2, B4, D4 to A2, E2, A4, E4. The new start is a theoretical draw: neither side can force a win. In simulated games between equal players (5% to 30% of moves are slips), the first player wins 50% to 53% of the time.
  • No other contradictions were found. The "no instant undo" rule applies far less often than its wording suggests, and the document should say so.

1. How it was checked

The game has a finite number of positions: 8,855 ways to place 4 water squares on the 23 movable squares, 23,256 ways to place the pieces, times whose turn it is. That is about 412 million basic positions, or 456,515,280 once the undo rule is counted. Starting from positions where a piece can step onto its flag, the computer works backwards, layer by layer, and labels every position with its result under best play: the side to move wins, loses, or nobody can force a win (a draw). This is called retrograde analysis, the method behind chess endgame tables. It took about 4 minutes on 4 cores; the longest forced win is 79 moves. Because the table covers every 4-hole terrain, any other opening can be looked up directly.

Cross-checks

  1. Self-check: on about 190,000 random positions, the backward and forward move rules mirror each other exactly. Zero errors.
  2. Two programs: the browser engine (JavaScript) and the solver (C) were written separately. Over 6,000 random long games and about 350,000 positions their legal move lists agree at every step, and their move counts from the start agree to depth 7 (4, 16, 64, 256, 1,152, 5,176, 25,822).
  3. Independent proof: the second player's winning strategy was exported and the JavaScript engine tried every reply for the first player, 12,121 distinct positions. Every line ends with the second player on its flag within 22 moves, with no threefold repetition along the way.

2. Finding one: the v0.4 opening is a second-player win

First move (Mint)Under best play
B5 to A5Coral wins within 21 more moves
D5 to E5Same (mirror image)
tile A5 to B4Coral wins within 21 more moves
tile E5 to D4Same (mirror image)

With Coral moving first, the same holds with colours swapped. One main line (the winner takes the fastest win, the loser holds out longest):

1 Mint B5→A52 Coral tile A1→B2 3 Mint A5→A44 Coral B1→B2 5 Mint tile E5→D46 Coral B2→B3 7 Mint D5→D48 Coral tile E1→D2 9 Mint D4→C410 Coral D1→D2 11 Mint A4→A512 Coral D2→C2 13 Mint C4→C314 Coral tile B2→B4 15 Mint C3→C416 Coral C2→C3 17 Mint A5→A418 Coral B3→B4 19 Mint A4→A320 Coral B4→B5 21 Mint A3→A222 Coral B5→C5, flag reached

This is not a small edge: with correct play the result is fixed before the first move. It also matters in practice. When each move has a fixed chance of being a random slip, the second player wins 83% of games at a 5% slip rate (close to expert play) and still 66% at 15%. Only near-random play (50%) evens out.

3. Why the document's own checks could not see it

Sections 8 and 11 of the document are careful: they already say that alternating the first move does not prove there is no first-move edge. The real situation is stronger than that warning, because each of the three existing checks is blind to this kind of problem by design.

None of this is an error in the document; only a full solve or a very deep search can show it. The suggestion is to rerun the solve after any change to the board, the opening or the win condition (the source is on this page).

4. Finding two: "no instant undo" applies only in a narrow case

Section 5.3 reads as if every tile move restricts the opponent's next move. In fact:

Two more points:

5. Checked and fine

6. Comparing fixes

Why not allow passing, or a choose-your-side rule

Moving only the water

Pieces stay on B5, D5 and B1, D1. The table lists every layout that is symmetric left to right and mirrored between the two sides. The win rates are for the first player in simulated games between equal players, 20,000 games per cell.

WaterPerfect playFirst wins
5% slips
First wins
15% slips
First wins
30% slips
Avg moves
5% slips
B2 D2 B4 D4 (v0.4)Second wins in ≤2217.1%33.8%43.5%20
A1 E1 A5 E5Second wins in ≤18not run
A2 E2 A4 E4 (suggested)Draw50.3%52.2%51.9%56
C2 A3 E3 C4Draw69.5%60.1%58.8%45
C2 B3 D3 C4Draw51.4%52.8%53.2%43
A3 B3 D3 E3Draw50.5%53.1%56.0%44

The suggestion is A2, E2, A4, E4:

  1. Smallest change: the water moves one file outward and stays on the same ranks.
  2. Closest to even at every skill level. C2 A3 E3 C4 is also a theoretical draw but clearly favours the first player in play, so a theoretical draw and fairness in practice both need checking.
  3. Longest games: 56 moves on average between strong players, the most room for strategy.
  4. No opening trap: stepping forward (B5→B4 or D5→D4) holds the draw; stepping sideways loses in theory but only after 49 moves, so it will not catch beginners. The second player has to think from move one: after B5→B4, Coral's B1→A1 loses within 7.

The runner-up is C2, B3, D3, C4: just as even, but more positions have only one move that holds (about 66% against 59%), so it plays sharper.

Limits: a simulated slip is a random move, unlike human mistakes, so play-testing with people is still needed. The simulation does not apply the repetition rule; it stops at 400 moves (no game got there), so human games may end in a draw more often. A theoretical draw means nobody wins with perfect play; real games are decided by who errs first. In drawn positions from this opening, only about 27% of moves keep the draw on average, so there is plenty of room to go wrong.

7. Suggested changes for v0.5

  1. Start with water on A2, E2, A4, E4. Everything else stays.
  2. Update the table in section 2 and the examples in sections 4 and 5.1: B4 is no longer water, and no piece touches water at the start, so the first move must be a step.
  3. Section 5.3: add when the undo rule actually applies. Section 7.2: count it in the position only when it blocks a move.
  4. Section 11: note that a full solve shows neither side has a forced win from the start, and rerun it after any board or opening change.

8. The demo's computer player

Easy looks one move ahead but knows that a piece next to its own flag wins next turn. Normal searches three moves, the same depth as v0.4. Hard deepens step by step with a fixed budget of 250,000 positions per move, so the same position always gets the same reply, with no clock and no randomness.

Tested on positions taken from the solve:

LevelForced win in 3 to 9: found a winning moveDraw with a trap that loses within 8: avoided it
Easy292 / 300204 / 300
Normal295 / 300237 / 300
Hard100 / 100100 / 100

Hard takes about 0.4 to 1.4 seconds per move. It is not a perfect player and can miss long plans.

9. Reproduce

The source is in this folder: solver.c (the solver) and replay.mjs, verify_strategy.mjs, probe_ai.mjs (checks against the browser engine). Needs about 4 GB of memory and 4 GB of disk.

gcc -O3 -march=native -fopenmp -o solver solver.c
./solver check 200000                 # backward and forward rules mirror each other
./solver solve table.bin              # full solve, about 4 minutes
./solver analyze table.bin            # start values, main line, every layout
./solver strategy table.bin coral.txt # export the second player's winning strategy
node verify_strategy.mjs coral.txt ../engine.js
./solver dump 3000 300 > games.txt  && node replay.mjs games.txt ../engine.js
./solver survey table.bin && ./solver sim table.bin