Skyscrapers

What this is?

One-file, pure JS + JSON solver for a Skyscrapers puzzle. Fill an N×N grid with heights 1..N so each row/column is a permutation, and the edge clues state how many buildings are visible from that side (taller buildings block smaller ones behind them).

  • Datasize N and four arrays of length N: top, bottom, left, right. Use 0 for “no clue”.
  • Policies — row/column all-different; visibility must match clues where given; values in 1..N.
  • Answer — derived facts (cell(r,c)=h).
  • Reason Why — line candidate filtering + intersection forcing (and branches if needed).
  • Check — row/col permutations, visibility matches, sums, ranges ( items).

Engine: precompute permutations of 1..N; filter by clues; alternate row/column propagation via position-wise intersections; branch on the smallest candidate line if needed.

Puzzle Details

  • Size: 6×6 (editable).
  • Sparser clues: moderate density — solvable by propagation with small search.
  • Editing tips: keep each clue array length = N and entries 0..N; fewer clues ⇒ more branching; more clues ⇒ faster/unique.

Data (JSON)

0 means no clue. Coordinates in the Answer are 1-based.

Policies (declarative JSON rules)

Controls

Solution Summary

Uniqueness Probe

(toggle “Probe uniqueness” then Run)

Answer (newly derived facts)

computing…

Reason Why (mathematical English)

(click “Run ARC”)

Check 0

computing…