Masyu 迴圈不能與自身交叉,也不能重訪除了用來封閉路徑的起始格以外的任何格子,因為每個 Masyu 棋盤都代表一條畫在單位方格網格上的簡單正交迴圈。線段只能在正交相鄰的格子之間移動,每個身體格子最多佔用一次,並且只能在封閉迴圈時再次接觸起始格,這表示任何重複使用非起始格或將一段線段疊在另一段之上的嘗試,都會在瀏覽器偵測到重複步驟時立刻被拒絕。

Masyu 是 Nikoli 風格的珍珠迴圈謎題,黑珍珠和白珍珠對路徑施加嚴格的局部轉彎與直線要求,但交叉與否的問題早在這些珍珠規則適用之前就已確定:根據定義,簡單迴圈不能與自身相交、分岔或倒退,這些結構限制在所有棋盤尺寸上都成立,包括Masyu Puzzle 所使用的精簡四乘四版本。

can the loop cross or reuse a cell when i play masyu puzzle
can the loop cross or reuse a cell when i play masyu puzzle

「簡單迴圈」在 Masyu 中的意義

「簡單迴圈」這個詞是圖論與謎題編寫中使用的技術術語,指的是一條最多造訪每個頂點一次的封閉路徑,而 Masyu 直接繼承了其迴圈繪製血統中的這個定義。實際上,Masyu 的解答是一連串格子,其中每對相鄰的格子共用一條邊,第一格與最後格相同,且序列中間沒有任何格子出現兩次。這就是為什麼 Masyu 網格呈現的是一條單一的連續緞帶,而非你在其他鉛筆謎題中可能看到的交錯軌道。

當謎題說路線不能「交叉或重訪自身」時,這兩個限制其實是同一條規則從兩個角度來看。交叉代表畫出新的一段線段,使其與先前的某段佔用同一個格子,這也是一種重訪。重訪一個格子代表路徑再次踏入已經屬於自己的格子,在方形網格上這會形成自交叉,或迫使迴圈產生分岔。這兩種情況都被簡單迴圈規則排除,因此瀏覽器的驗證只需要一個檢查:所提議的步驟是否落在已經屬於路線一部分的格子上(封閉時的起始格除外)?

這單一的檢查正是 Masyu 明顯比允許交叉的迴圈謎題更乾淨的原因。你不需要規劃「哪條線在上層」,也不需要記住邊線優先順序規則,因為路徑永遠是平坦的、永遠不會自交,並且在四乘四鍵盤棋盤上永遠剛好是一個格子寬。

為什麼交叉會破壞 Masyu

如果 Masyu 迴圈與自身交叉,白珍珠的規則就無法再一致地被滿足。白珍珠要求線段筆直通過它,並且其至少一個緊鄰的格子帶有轉彎,因此任何被路徑造訪兩次的格子,根據被重複的是哪一段,可能會無法通過「筆直通過」的測試、無法通過「鄰格轉彎」的測試,或兩者皆無法通過。對於黑珍珠,規則更嚴格:路徑必須在珍珠上轉彎,並在兩端各繼續保持直線,而這個轉彎無法在已經屬於同一迴圈另一段的一部分的格子上呈現。

除了珍珠的限制之外,自交叉的迴圈也會破壞鍵盤棋盤所使用的計分模型。Masyu Puzzle 的分數從 1,000 開始,每接受一個路徑步驟就扣十分,因此一個乾淨的十二步周長解答會落在 880 分。如果棋盤允許交叉,多出的兩個被接受的步驟只會損失二十分,分數就不再獎勵最乾淨的解答,這也是引擎會直接拒絕產生重複的步驟的部分原因。

驗證機制刻意設計得較為保守。一旦路徑進入已經屬於路線一部分的身體格子,瀏覽器就會回報偵測到死胡同,並且線條無法再從該處繼續延伸,因為延伸會使迴圈產生分岔或將路徑推回自身之上。離開這種狀態的乾淨方式是從原始游標位置以空白路徑重新開始。

如何繪製合法的 Masyu 迴圈

在固定四乘四棋盤上的鍵盤操作流程圍繞著簡單迴圈規則構建,因此每個控制項都假設存在一條單一的不交叉線條。以下步驟會產生已揭露的十二步周長解答以及對應的 880 分。

  1. Move the cursor to the black pearl in the upper-left corner of the four by four grid; this is the starting cell where the loop will also close.
  2. Press Space or Enter on the black pearl to begin the loop, which marks that cell as the start of the path and locks the cursor there.
  3. Press the right arrow key three times so the path travels across the top row of the grid, passing straight through the white pearl that sits immediately to the right of the black pearl; each accepted arrow step subtracts ten points from the starting 1,000-point score.
  4. Press the down arrow key three times so the path travels down the right edge of the grid toward the bottom-right corner.
  5. Press the left arrow key three times so the path travels back across the bottom row of the grid toward the lower-left corner.
  6. Press the up arrow key three times so the line climbs the left edge of the grid; the third up arrow arrives at the black pearl and closes the route at the start cell.
  7. The browser runs the closure test, checking for unique body cells, clue coverage, straight passage with a neighboring turn at the white pearl, and a turn with two straight arms at the black pearl.
  8. If every check passes, the closed route is reported as solved and the final score is displayed; the disclosed clean solution is 1,000 minus ten times twelve accepted steps, which equals 880.
  9. Press the Restart control to restore the original cursor, an empty path, the starting 1,000-point score, and the unsolved status, so you can replay the route without reloading the page.

排除巧妙交叉的珍珠規則

珍珠限制賦予簡單迴圈規則其 Masyu 特有的風味,因為它們將原本可能輕鬆的繪圖謎題轉變為嚴密的局部邏輯練習。在白珍珠上,線條必須筆直通過該格,並在其至少一個緊鄰格中轉彎,這就是為什麼已揭露的解答會沿著頂邊筆直行進,並在右上角轉彎,而不是以斜向穿過白珍珠。

Pearl Type Path Behavior On the Pearl Required Neighbor Behavior Effect If Violated
Black pearl Line must turn on the pearl itself Both adjacent cells stay straight Path is rejected at closure
White pearl Line must pass straight through the pearl At least one adjacent cell carries a turn Closure check fails
Empty body cell Any straight passage is allowed No local constraint None on its own

在黑珍珠上,線條必須在珍珠上轉彎,並筆直通過其兩個緊鄰格,這就是為什麼已揭露的解答會在左上方的黑珍珠上轉彎,然後沿著左邊緣筆直向上以封閉迴圈。如果路徑在珍珠附近與自身交叉,珍珠限制仍然會根據唯一格規則進行評估,路線會在分數定案之前就被回報為無效。

這些局部限制正是「接觸每個線索」不等同於解開 Masyu 的原因。一條蜿蜒穿過每顆珍珠而不交叉或重訪的路徑,仍可能因為通過白珍珠後附近沒有轉彎而違反白珍珠規則,也可能因為在黑珍珠上轉彎後又在其中一條臂上再次彎曲而違反黑珍珠規則。瀏覽器的封閉測試會同時檢查這兩點,這就是為什麼乾淨的十二步周長會勝出,而任何其他被接受的組態仍必須滿足相同的六項封閉條件:唯一的身體格子、完整的線索覆蓋、白珍珠周圍的共線性、白珍珠處的鄰格轉彎、黑珍珠本身單獨的轉彎,以及黑珍珠兩側筆直的臂。

迴圈與珍珠限制的常見錯誤

鍵盤棋盤上大多數失敗的嘗試都屬於三類錯誤之一,理解每一類都有助於釐清為什麼簡單迴圈規則與珍珠規則無法妥協。

第一類是過早封閉。如果路徑在一或多顆珍珠仍未被造訪時就回到起始格,瀏覽器會回報路線已封閉,但會將其標記為無效,因為線索覆蓋檢查失敗。修正方法是延長路線,使每個標記的珍珠在封閉前都已位於線上,而在這個四乘四的棋盤上,這意味著完整的十二步周長。

第二類是在錯誤類型的珍珠上彎曲。在頂排的白珍珠上轉彎,或在左上角的黑珍珠上筆直通過,都會在封閉時失敗,因為白珍珠將不再具有「筆直通過」的線段,而黑珍珠將不再在自己的格子上有轉彎。修正方法是記住已揭露的幾何結構:白珍珠走直線,黑珍珠轉彎。

第三類是嘗試以對角線或跳格來抄捷徑。由於路線只能在正交相鄰的格子之間移動,對角線移動不屬於被接受的輸入,而跳過空白格會被視為離開棋盤,鍵盤介面會以靜默方式處理。任何跳格的嘗試都會迫使路徑稍後重訪或產生分岔,因此已揭露的周長同時也是不違反簡單迴圈規則的十二步解答。

Recovery Controls When the Path Gets Stuck

Because the loop cannot cross or reuse cells, getting stuck is a normal part of the early attempts on this board. The recovery controls are deliberately small so they can be exercised without leaving the page. Restart resets the cursor, empties the path, restores the 1,000-point starting score, and clears the solved status, which is the cleanest way to recover from a dead end without reloading.

Escape twice within 400 milliseconds reveals the shared simulated spreadsheet boss screen, and repeating the double press returns to the unchanged puzzle underneath. The boss screen does not pause a timer, because there is no timer on this board, and it does not save partial state, because the only persisted value is the best completed score held in this browser's localStorage. That score is never uploaded or attached to an account, so closing the tab keeps the best run in place and reopening the browser will surface it again on the next completion.

For readers who enjoy this kind of single-loop deduction, the related games in the same family use similar non-crossing constraints on different clue shapes. Shingoki Puzzle layers number and segment-sum clues onto a loop, while Pipes Puzzle rotates fixed tiles until they form one connected network without a closed loop, which makes the contrast with Masyu's mandatory single loop easier to feel.

If you're weighing options, Number Fill-In Puzzle: Why the Given Cells Can't Change covers this in detail.

If you're weighing options, Can the Loop Revisit a Cell in Shingoki Puzzle? covers this in detail.