Abstract orthogonal wall surrounding white clues while leaving black clues outside
Castle Wall is fundamentally about a boundary: every segment changes what belongs inside and what remains outside.
Play nowOpen Castle Wall in Blupoli Puzzles. Choose 6×6, 8×8, 10×10, or 12×12, then play any size on Easy, Normal, Hard, or Expert.

The single idea behind the whole puzzle

A closed loop has a useful property: it divides a plane into two sides. Castle Wall exploits that property without requiring the player to think like a mathematician. You draw one orthogonal route through the centres of some empty cells. The route may not cross itself, branch, or split into separate loops. Clue cells are pillars rather than track: the wall must flow around them and can never enter them.

Clue colour supplies the first kind of information. A white clue must end up inside the loop. A black clue must end up outside. That sounds global, but it creates local deductions quickly. When white and black clues sit close together, a valid boundary must separate them somewhere. When several clues of the same colour form a cluster, the wall is often pushed around the outside of that cluster.

Numbered arrows provide the second kind. An arrow looks in one of the four orthogonal directions, and its number tells you how many wall segments its ray crosses. You can also think of it as counting grid boundaries crossed by the loop along that line of sight. Zero clues are particularly strong because they rule out every crossing along a ray. Larger values leave several placements possible, but those placements still have to belong to one closed loop.

Where Castle Wall comes from

Castle Wall has a clearer paper trail than many pencil-puzzle genres. Palmer Mebane published a description on his archived Melon's Puzzles site and described the type as original to that blog to the best of his knowledge. That careful wording is worth preserving. We do not need to turn an author's claim into a tidier or more dramatic history than the sources support. His description establishes the same core ideas used here: one closed loop, clue cells that cannot be visited, white clues inside, black clues outside, and arrows that count crossings in a direction.

The genre later spread through the international puzzle community. Grandmaster Puzzles has published classic Castle Wall and variants, while pzprjs added its castle type in version 0.12.0 and credited Lennard Sprong for that addition. The open implementation is valuable for checking rule details and failure conditions. It is not a puzzle bank for Blupoli to copy.

That distinction matters. A puzzle genre can have shared rules while each product still owns its interaction design, accessibility, generation, difficulty model, persistence, and visual language. Blupoli generates new instances from its own seeds and validates them with its own solver rather than embedding someone else's published boards.

How to read a clue without mixing its jobs

It helps to separate colour from number. Colour describes the final global relationship: inside or outside. The arrow describes one particular line of sight. When a clue carries both, those are two independent constraints. A white 0→ clue must be inside the final wall and must see no wall crossing to its right. That combination may force the loop to pass above, below, or to the left instead.

Clues without numbers still matter. A plain white clue remains an obstacle and must remain inside. A plain black clue remains an obstacle and must remain outside. Blupoli uses that separation as part of difficulty calibration: easier boards retain a high proportion of numbered arrows, while harder boards rely more heavily on colour, geometry, and loop continuity.

Parity offers another useful mental model. Imagine firing a ray from a cell to the edge of the board. Every time the ray crosses the closed wall, it changes side. After an odd number of crossings you are on the opposite side; after an even number you are on the same side. Players do not need to calculate parity formally, but the idea explains why a single closed boundary can classify every clue consistently.

The wall does not have to visit every empty cell

Castle Wall is not a Hamiltonian puzzle. The loop uses some empty cells and leaves others untouched. That freedom is one of the main sources of difficulty. In a narrow corridor between clue cells, the continuation may be nearly forced. In an open area, several detours can look plausible until arrow counts, clue colours, and the one-loop rule eliminate all but one.

Two mistakes are especially common. The first is closing a small loop too early. It may satisfy the nearby clues and still make the rest of the board impossible. The second is allowing a temporary branch with the idea that it can be repaired later. It cannot: every cell used by the final wall has exactly two connections. A third connection already violates the structure of the puzzle.

Blupoli therefore lets each possible connection cycle through undecided, wall, and excluded states. You do not have to mark every impossibility, but doing so is useful when a long deduction removes a route. Undo and Redo make experimentation reversible; Restart keeps the same generated board, while New Game changes the seed.

Text-free diagram showing white and black clues separated by an orthogonal loop
One boundary must satisfy local arrow counts and the global inside/outside classification at the same time.

Generation starts with a valid solution

Blupoli's generator begins at the end. It constructs a simple cycle on the grid, starting from an orthogonal ring and applying controlled detours that add corners without allowing the route to cross or repeat a cell. The number of attempted detours rises with difficulty and board size so that the hidden answer does not collapse into an obvious rectangle.

Once the cycle exists, every cell outside the route can be classified as geometrically inside or outside with a point-in-polygon test. That classification determines whether a potential clue is white or black. For each numbered clue, the generator chooses a direction and counts the exact solution edges crossed by that ray. Clues are derived from a known valid wall rather than scattered randomly before hoping that a wall exists.

This construction proves that at least one solution exists, but it does not prove uniqueness. That distinction is central to the implementation. A generator that knows one answer can still create an ambiguous puzzle. Publishing requires a second component to search for alternatives.

An independent solver checks the generator

The solver operates on the graph of cells that the wall is allowed to visit. Clue cells are removed because the route cannot enter them. Every remaining orthogonal connection becomes a binary decision: selected as part of the wall or excluded. During search, the solver tracks the degree of every cell and immediately rejects states that would create more than two connections or strand a live endpoint with no possible continuation.

Numbered arrows add cheap but powerful pruning. For each clue, the solver knows which candidate connections can cross its ray. If selected edges already exceed the target, the branch is impossible. If even selecting every undecided candidate could not reach the target, that branch is impossible too. Those bounds eliminate large portions of the search tree before a complete loop has to be reconstructed.

At a full assignment, the solver demands degree zero or two everywhere, checks that all selected segments belong to one connected component, reconstructs the cycle, verifies every clue colour against the actual geometry, and recounts every numbered arrow. During generation it counts only to two solutions. One means unique; finding a second is enough to reject the candidate.

Uniqueness is a gate, not a feeling

"It looks unique" is not a publishing criterion. A generator can produce hundreds of convincing boards and still hide an alternate route in an unremarkable corner. The regression bank therefore does more than compare the intended solution with the rules. It invokes the solver and requires exactly one solution for every tested seed.

The search also has a budget. If a candidate is so awkward that the solver cannot finish inside that budget, Blupoli does not interpret the timeout as proof of uniqueness. The result is inconclusive and the candidate is discarded. This avoids a subtle but important mistake: failing to find a second solution is not the same as proving that none exists.

Seeds make failures actionable. Size, difficulty, and seed identify a reproducible generated board. If a combination exposes ambiguity, slow generation, or poor calibration, it can become a permanent regression case instead of vanishing the moment someone clicks New Game.

Four sizes change the space, not the rules

Castle Wall ships with 6×6, 8×8, 10×10, and 12×12 boards. The smallest format is a comfortable place to learn the relationship between clue colour and arrow counts without a long route overwhelming the picture. At 8×8, detours and alternative corridors have room to emerge. The two larger sizes allow several regions of the board to interact before a local deduction resolves the rest.

Size does not stand in for difficulty. A 12×12 Easy board can contain more cells than a 6×6 Expert board while still providing more explicit information and fewer off-solution empty cells. A small Expert board can instead offer a compact space with several plausible routes and fewer numbered arrows. Both are legitimate forms of challenge.

Keeping the controls independent also makes calibration testable. We can compare Easy, Normal, Hard, and Expert while holding board dimensions constant. If difficulty were merely another name for the four sizes, there would be no evidence that the generator was actually controlling logical pressure.

What difficulty means in this implementation

The generator uses two visible levers and one independent measurement. The first lever is the number of additional empty cells that do not belong to the intended cycle. Those cells create extra routes that the solver must consider. The second is the proportion of clues that retain a number and arrow. Reducing that proportion shifts more work onto inside/outside reasoning and loop continuity.

The independent measurement is solver search nodes. We do not claim that node count perfectly predicts human solving time. A search program and a person do not reason in the same order. It is, however, a reproducible signal that the same algorithm has to eliminate a larger space of alternatives. The stress gate requires the average node count to increase from Easy to Normal, Normal to Hard, and Hard to Expert for every board size.

That is substantially better than a cosmetic label, but it is not treated as eternal truth. If play experience later shows that two bands feel too similar, the calibration can change. Seeds, metrics, and permanent tests make it possible to tune the model without accidentally turning Expert back into Easy.

Eight thousand puzzles before integration

The dedicated generator validation runs 500 seeds for every combination of four sizes and four difficulties: 8,000 generated puzzles. Every instance must finish generation within budget, the known cycle must satisfy the rules, and the independent solver must find exactly one solution. The workflow also aggregates search nodes and checks the expected ordering of difficulty bands.

The permanent test in the normal suite uses 100 seeds per combination, or 1,600 puzzles. That smaller sample is deliberate. It is large enough to catch a broad class of regressions without making every unrelated repository change wait for the full stress campaign. The Castle Wall workflow performs the larger run whenever the engine or its manifest changes.

Both layers matter. Tiny tests are fast but can miss rare cases. Huge campaigns on every commit can make development unnecessarily slow. The permanent bank protects day-to-day work; the dedicated stress gate provides stronger evidence before the game reaches main.

Controls designed for exploration

Every possible connection between two free cells has three states: undecided, wall, and excluded. Mouse, touch, and keyboard share that model. Tab can focus a connection and Enter or Space changes its state. The interactive target is deliberately wider than the visible line, so using a finger does not require pixel-perfect aim.

Hints are intentionally narrow. If the current state contains a selected segment that contradicts the known solution, the hint removes that mistake first. Otherwise it reveals one correct connection that is still missing. The feature remains a local nudge rather than a button that solves a whole region. Clear removes decisions, Restart returns to the same base, and New Game creates another seed.

Completion does not depend on whether the drawing merely resembles the generator's stored answer. The engine validates the player's state as a complete Castle Wall: one loop, correct clue colours, and exact arrow counts. That makes the win condition rule-based rather than a fragile visual comparison.

Responsive by belonging to the app shell

Blupoli Puzzles uses a full-height application shell. Castle Wall does not create its own site header, footer, or outer page frame. It receives the rectangle owned by #game-root.game-stage and fits inside it. On desktop the SVG stays square and uses available height without pushing the action dock away. On mobile and portrait layouts it scales primarily from width inside the game's internal scroll area.

SVG keeps lines crisp across sizes. Black and white clues retain contrast, numbers stay centred, and route dots remain visible without competing with the wall. Transparent hit targets are much wider than the visible stroke, allowing touch accessibility and visual restraint to coexist.

Playwright covers a 360×640 phone, portrait tablet, and desktop. Loading is not enough: the board must remain inside the useful viewport, size and difficulty controls must remain independent, a connection must respond to keyboard input, and the page must produce no JavaScript errors.

A practical way to start solving

Look for zero arrows first. A 0 clue removes every possible crossing along its ray. Then inspect nearby clues of opposite colours: the wall has to separate them. When they are close, that obligation often narrows the route dramatically. Same-colour clusters suggest the opposite idea — find a route that leaves them together on the same side.

Whenever you place a segment, check the neighbouring route cells. A used cell needs exactly two connections. Once it has two, every other incident connection is excluded. If a cell already has one segment and only one legal exit remains, that exit is forced. This degree reasoning appears in many loop puzzles and becomes especially productive here because clue cells carve the board into corridors.

Do not neglect larger arrow values. They can look weak because several distributions satisfy them in isolation, but two arrows looking into the same area may share candidate crossings and force a combination. Harder boards deliberately lean on these interactions instead of giving every useful fact as a direct local clue.

How Castle Wall differs from other loop puzzles

If Castle Wall clicks with you, Masyu shares the discipline of making one loop, but its circles describe turns and straight runs. Slitherlink uses local numbers around cells and draws on a different lattice. Yajilin combines a loop with shading and directional clues. Country Road adds regions and route restrictions.

Castle Wall stands apart because inside and outside are not a side effect of drawing a loop. They are first-class clue information. Solving repeatedly switches between two scales of thought. At one scale you reason about degrees, corridors, and individual segments. At the other you reason about one closed boundary separating entire sets of clues.

That combination is why the genre earns a native place in Blupoli rather than simply increasing the catalogue count. It adds a reasoning style that complements existing loop games and gives the difficulty system a different search landscape to measure.

What Blupoli integration verifies

The game does not live in isolation. The catalogue is generated from games/castle-wall/game.json; changing its status to available automatically includes Castle Wall in the dynamic smoke test for every published game. That smoke test requires the route to mount without console errors or engine failures, expose interactive controls, and provide the shared guide experience.

Completion uses the shared progress layer and records a common result with size, difficulty, and seed. Progress can therefore store a Castle Wall session without the game inventing a parallel statistics system. Onboarding, quick facts, tips, and related games also come from the canonical manifest.

Finally, npm run verify runs repository tests, checks, and the build, while Playwright exercises both global contracts and Castle Wall-specific behaviour. Publishing the game must prove not only that Castle Wall works but that its arrival does not damage the rest of Blupoli Puzzles.

What we deliberately did not copy

A puzzle genre's rules are shared knowledge; another publisher's concrete boards, editorial wording, code, and artwork are not. Blupoli does not embed puzzles published by Melon's Puzzles, Grandmaster Puzzles, puzz.link, or other collections. It does not reproduce their interface either. The generator creates new instances from Blupoli seeds and the solver verifies those instances.

pzprjs is open software and its Castle Wall implementation is a valuable reference for checking rule semantics. For this release, however, a native engine gives us direct control over generation, difficulty metrics, state handling, and integration with the current app shell. Reference material helps us verify concepts; it does not replace Blupoli's design.

That separation also improves auditability. We can explain where each clue comes from, what proves uniqueness, and which metric moves difficulty without relying on an opaque external dataset.

A simple boundary with a lot to say

Castle Wall works because it turns an elementary geometric fact into a conversation among clues. A white clue asks, "How will you keep me inside?" A black clue asks, "How will you keep me outside?" An arrow adds, "And how many times will you cross here?" The loop has to answer all of them at once while remaining one loop.

For Blupoli, completing the game meant respecting that conversation in code as well. The generator knows a solution but does not trust it. The solver searches for alternatives. Seeds make failures repeatable. Difficulty is observed through metrics instead of being changed only by a label. CI generates thousands of boards before a change is allowed to reach main.

The best explanation is still a game. Start with 6×6 Easy until colour and arrows feel natural. Keep the same size and move to Normal: some explicit information disappears and extra route choices appear. Once that transition feels comfortable, Hard and Expert use the same vocabulary to create a much more global problem.

Sources and further reading

Build the wallPlay Castle Wall and compare two consecutive difficulties at the same size to feel how the decision space changes without changing the grid dimensions.