借路 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 洞的地形,換一種開局也能直接查出結果。
交叉檢查
- 求解器自我檢查:隨機抽約 19 萬個局面,確認「往回推」和「往前走」完全互為鏡像,0 錯誤。
- 兩套程式對照:網頁上的規則引擎(JavaScript)和求解器(C)分開撰寫。兩者在 6,000 盤隨機長局、約 35 萬個局面上逐步比對合法走法清單,0 不一致;從開局數到第 7 手的所有走法序列(4、16、64、256、1,152、5,176、25,822)也完全相同。
- 獨立證明:把後手的必勝策略匯出,由 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 節很謹慎,已經提醒「先手輪替不等於證明沒有先手優勢」。實際情況比這句提醒更嚴重:原有的三種檢查,在結構上都看不到這類問題。
- 換色對稱檢查只能證明「薄荷先走」和「珊瑚先走」一樣,無法比較「先走」和「後走」。這次的問題正好出在先後,不在顏色。
- 先手輪替在連續對局中反而會把問題藏起來:每個人都在自己後走的那局獲勝,比分永遠接近 1:1,看起來很公平,其實每一局在開始前就已決定。
- 三手搜尋的電腦看不到 22 手深的必勝線,所以電腦對戰的結果也不會暴露問題。
這不是文件寫錯,而是這類問題只有完整求解或很深的搜尋才看得出來。建議往後每次改動棋盤、開局或勝負條件,都重新跑一次求解(本頁附原始碼)。
4. 發現二:「禁止立即搬回」只在很窄的情況下生效
文件 §5.3 的寫法,容易讓人以為每次搬地板後,對手下一手都受到限制。實際上:
- 搬地板時,來源和落點都貼著同一枚支點棋子。如果兩格在支點的兩側(排成一直線),唯一同時貼著兩格的就是那枚支點棋子本身,對手根本沒有棋子能把它搬回去,限制不會發生作用。
- 只有來源和落點成斜角,而且這個 2×2 方塊的第四個角剛好站著對手的棋子時,限制才真正擋住一步棋。
- 在 3,000 盤隨機對局的 180,876 個局面中,限制真正生效的只有 2,307 個(約 1.3%)。
另外兩點:
- 限制永遠不會逼人跳過。限制生效時,那枚對手棋子貼著剛放好的地板,隨時可以改成走上去。掃描全部局面也找不到反例。
- 判斷「同一局面」的方式。文件 §7.2 把搬回限制算進局面。如果實作是每次搬地板後都記錄限制(包括不可能生效的情況),兩個在玩家眼中完全相同、可選的走法也完全相同的局面,會被當成不同局面,「和」的提醒可能比預期晚出現。建議改成:只有限制真的會擋住某一步時,才算進局面。本 demo 採用這個做法;它不改變任何局面的勝負。
5. 檢查過、沒有問題的部分
- 走棋不會破壞「不得完全封死」。棋子只走到相鄰地板,仍在同一片相連的地板上,所以只需要在搬地板後檢查。文件的做法正確。
- 和棋很少。在輪到薄荷、沒有搬回限制的 2.06 億個局面中,理論和棋只占約 1.5%。用棋子堵路雖然合法,並不會讓這個遊戲變得容易和棋。
- 被迫跳過確實會發生(3,000 盤隨機對局中出現 36 次),文件 §6 的處理沒有矛盾。
- 抵達旗格優先於三次重複、資訊完全公開、沒有隨機,都和規則一致。
6. 修法比較
為什麼不用「允許跳過」或「選邊規則」
- 允許主動跳過:開局雙方都不想先動,就會互相跳過,很快進入三次重複和棋,遊戲失去張力。(這個變體沒有重新求解,此為推論。)
- 選邊規則(一方先走第一手,另一方再選要哪一邊):v0.4 開局任何第一手都會讓「接著走的一方」必勝,選邊的人只要選接著走的那方就贏,問題沒有解決。
只改水洞位置
棋子仍在 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,理由如下:
- 改動最小:水洞只往外移一欄,所在的列不變。
- 各種程度都最接近五五波。C2 A3 E3 C4 雖然理論上也是和棋,實戰卻明顯偏向先手,可見「理論和棋」不等於「實戰公平」,兩者都要檢查。
- 棋局最長。高手局平均 56 手,策略空間最大。
- 開局不是陷阱。先手往前走(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 改動清單
- 初始水洞改為 A2、E2、A4、E4。其餘規則不變。
- 更新文件 §2 的表格,以及 §4、§5.1 的例子:B4 不再是水洞,開局時棋子旁邊沒有水洞,所以第一手只能走棋。
- §5.3 補一句限制實際生效的情況;§7.2 改成「只有會擋住某一步的搬回限制,才算進局面」。
- §11 補上:開局已用完整求解確認雙方都沒有必勝。往後改棋盤或開局,重跑一次求解。
8. Demo 的電腦對手
簡單:只看一步,但認得「棋子已貼在自己旗格旁=下一步必勝」。普通:三手搜尋,和 v0.4 同深度。困難:逐步加深的搜尋,每步固定 25 萬個節點上限,所以同一局面永遠得到同一步,不靠計時,也不靠隨機。
用求解結果出題測試:
| 難度 | 3 到 9 手內必勝的局面,找到致勝手 | 理論和棋、有 8 手內會輸的陷阱,成功避開 |
| 簡單 | 292 / 300 | 204 / 300 |
| 普通 | 295 / 300 | 237 / 300 |
| 困難 | 100 / 100 | 100 / 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
- Self-check: on about 190,000 random positions, the backward and forward move rules mirror each other exactly. Zero errors.
- 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).
- 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 A5 | Coral wins within 21 more moves |
| D5 to E5 | Same (mirror image) |
| tile A5 to B4 | Coral wins within 21 more moves |
| tile E5 to D4 | Same (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.
- The colour-swap symmetry check shows that Mint-first equals Coral-first. It cannot compare moving first with moving second, and that is exactly where the problem is.
- Alternating the first move hides it over a series: each player wins the game where they move second, so the score stays near 1:1 and looks fair, while every single game is decided in advance.
- The three-move computer cannot see a 22-move forced win, so computer games do not expose it either.
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:
- The tile's old and new squares both touch the same anchor piece. If they sit on opposite sides of it, in a straight line, the only piece touching both is the anchor itself, so the opponent can never move the tile back and the rule never applies.
- The rule only blocks a move when the two squares are diagonal and the fourth corner of that 2×2 block holds an opponent's piece.
- In 3,000 random games, the rule actually blocked something in 2,307 of 180,876 positions (about 1.3%).
Two more points:
- The rule can never force a pass. Whenever it applies, the opponent's piece touches the tile that was just placed and can step onto it instead. A scan of every position found no exception.
- What counts as "the same position". Section 7.2 includes the undo rule in the position. If the code records it after every tile move, including cases where it can never apply, two positions that look the same and offer exactly the same moves are counted as different, and the draw warning can come later than players expect. Suggested wording: count the rule only when it actually blocks a move. This demo does that; it does not change the result of any position.
5. Checked and fine
- Steps never break the "no sealing off" rule. A piece only steps onto a neighbouring floor square, which is in the same connected area, so checking after tile moves is enough. The document gets this right.
- Draws are rare. Among the 206 million positions with Mint to move and no undo rule in force, only about 1.5% are theoretical draws. Blocking with pieces is legal but does not make the game drawish.
- Forced passes do happen (36 times in 3,000 random games), and section 6 handles them consistently.
- Reaching the flag beats the repetition rule, all information is open, and nothing is random, as stated.
6. Comparing fixes
Why not allow passing, or a choose-your-side rule
- Allowing a voluntary pass: neither side wants to move first, so both pass and the game soon ends in a repetition draw. (This variant was not re-solved; this is reasoning.)
- Choose-your-side (one player makes the first move, the other picks a side): in v0.4 every first move leaves the side to move winning, so the chooser simply takes that side. Nothing changes.
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.
| Water | Perfect play | First wins 5% slips | First wins 15% slips | First wins 30% slips | Avg moves 5% slips |
| B2 D2 B4 D4 (v0.4) | Second wins in ≤22 | 17.1% | 33.8% | 43.5% | 20 |
| A1 E1 A5 E5 | Second wins in ≤18 | not run | | | |
| A2 E2 A4 E4 (suggested) | Draw | 50.3% | 52.2% | 51.9% | 56 |
| C2 A3 E3 C4 | Draw | 69.5% | 60.1% | 58.8% | 45 |
| C2 B3 D3 C4 | Draw | 51.4% | 52.8% | 53.2% | 43 |
| A3 B3 D3 E3 | Draw | 50.5% | 53.1% | 56.0% | 44 |
The suggestion is A2, E2, A4, E4:
- Smallest change: the water moves one file outward and stays on the same ranks.
- 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.
- Longest games: 56 moves on average between strong players, the most room for strategy.
- 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
- Start with water on A2, E2, A4, E4. Everything else stays.
- 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.
- Section 5.3: add when the undo rule actually applies. Section 7.2: count it in the position only when it blocks a move.
- 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:
| Level | Forced win in 3 to 9: found a winning move | Draw with a trap that loses within 8: avoided it |
| Easy | 292 / 300 | 204 / 300 |
| Normal | 295 / 300 | 237 / 300 |
| Hard | 100 / 100 | 100 / 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