Inspirations

The Knight's Tour

A carved chess knight hops across a walnut-and-maple board, visiting all 64 squares exactly once using Warnsdorff's rule. A glowing thread traces its path until the closed tour's pattern appears, then a new tour begins.

Generated automatically by Claude API (automat) with claude-opus-5.5: the automat wrote the page, looked at its screenshots and fixed it where needed. This is not a single-shot result: comparisons on this site show models in one attempt.

Starting prompt

Build "The Knight's Tour": a cinematic, real-time 3D scene of a single chess knight solving the classic knight's tour puzzle on a polished wooden board. The knight visits all 64 squares exactly once and finishes one knight's move from its start, so the tour is closed. Its path is left behind as a glowing thread that slowly weaves into an intricate pattern. Single self-contained HTML file; Three.js and its addons from a CDN via an import map are fine; build everything procedurally (canvas textures are fine), with no external models or image files.

The puzzle is the heart of the piece. It must be a real computed tour, not a canned path:
- Squares are indexed (file 0–7, rank 0–7), and the eight knight moves are (±1, ±2) and (±2, ±1).
- Compute the tour with Warnsdorff's rule: always move to the unvisited square with the fewest onward unvisited moves. Break ties by the smallest Euclidean distance from the board centre, then randomly.
- Accept the tour only if all 64 squares are visited and the last square is a knight's move from the first, so the tour is closed. Otherwise retry with a fresh random tiebreak, for up to 200 attempts. Keep a small depth-limited backtracking fallback so that a closed tour is always found within a few milliseconds.
- Each new tour starts from a different square. Show each move in algebraic notation, for example "Ng1–f3", with files a–h and ranks 1–8.

The board and piece, with true proportions (metres, y up):
- Tournament board: squares 5.7 cm wide, a 45.6 cm playing area, a 3 cm mahogany frame with a small bevel and a 2 cm thickness.
  - Light squares are pale maple and dark squares are walnut. Paint the wood grain on canvas: long, slightly wavy fibres, with the grain direction alternating per square as in real inlay, and a faint varnish gloss.
  - Small a–h and 1–8 coordinates are engraved in gold on the frame.
- The board sits on a dark green baize table that fades into darkness.
- Staunton knight, about 6 cm tall, ebonised, glossy black wood with a warm sheen:
  - a LatheGeometry base of about 4 cm diameter, with a stepped plinth, a collar and a felt underside;
  - the horse's head is an ExtrudeGeometry of a carefully drawn horse-head profile Shape (forehead, ears, eye notch, muzzle, jaw, arched neck and a mane ridge), extruded about 1.6 cm with a generous bevel so that it reads as carved;
  - small eye indents and nostrils, and a slight carved mane made of a few raised strips.
- A second ghost piece: a faint translucent white knight marks the starting square, so that the closing move is visible.

The motion:
- Each hop takes about 0.55 s. The knight lifts along a smooth parabolic arc, about 4 cm high, turns to face its direction of travel, tilts slightly forward, then settles with a tiny bounce and a soft dust of light particles.
- On landing, the square shows a small engraved move number (1–64) that fades in, in a warm gold serif drawn on a canvas atlas, and a faint warm glow pools on it.
- The thread is a TubeGeometry along a CatmullRom curve through the square centres, at 3 mm above the board, with a tiny lift between squares. It is rebuilt or extended incrementally as each hop completes, and the newest segment animates along with the knight. Colour it with a gradient from ember orange (move 1) to pale gold to ice white (move 64), with an emissive glow.
- Options preview: before each hop, small luminous dots appear on every legal unvisited target square. Each dot shows its Warnsdorff degree as tiny pips, and the chosen square pulses. This is visible and readable, but subtle.

The film: one cycle lasts about 45 seconds, and the camera moves on its own throughout.
1. The opening: a low three-quarter view near the knight, with shallow depth of field (BokehPass or a subtle custom blur) and slow tracking.
2. Midgame: the camera orbits slowly at about 35° elevation as the pattern grows.
3. The closed tour: after move 64, the closing link draws back to the start square. The camera rises to a near top-down view, the full thread brightens with a gentle bloom pulse, and the pattern's symmetry reads clearly for about 6 seconds.
4. Reset: the numbers and the thread fade out in reverse order like embers, the knight hops to a new start square, and the next tour begins.

Lighting and look: a warm key light like a library lamp, with soft PCF shadows of the knight on the board; a cool rim light; ACES tone mapping; a subtle UnrealBloomPass that catches only the thread and the dots (high threshold); a soft vignette; and gentle dust motes drifting in the lamplight. The scene is rich, dark and quiet, and never washed out.

Interface:
- In the top-left corner, the title "The Knight's Tour" in an elegant serif (Google Font, for example Cormorant Garamond). Under it, one caption line: the current move ("Move 23 · Nd5–f6 · 2 onward moves"), then the closed-tour message ("Closed tour: 64 squares, each visited once").
- A small "Show options" toggle and a tiny speed control with three steps.
- Tap or click any square to start a new tour from there.
- Drag to orbit and scroll or pinch to zoom, with touch working too. The camera returns to the film path a few seconds after the last input.
- Everything starts automatically and is visibly moving from the first frame (the knight is already mid-hop at move 3), without any interaction. The layout works at 1150×700 and on a phone at 390×844: on narrow screens, frame the board smaller and wrap the caption.

Engineering rules (the page must work on the first load, with no fixes):
- Use Three.js r170 from the CDN via exactly this import map: <script type="importmap">{"imports":{"three":"https://cdn.jsdelivr.net/npm/three@0.170.0/build/three.module.js","three/addons/":"https://cdn.jsdelivr.net/npm/three@0.170.0/examples/jsm/"}}</script>. Use only methods that exist on each of its classes. Give every custom ShaderMaterial `fog: false`, and declare every uniform, constant and varying its shaders use.
- No fetches of any kind, other than Three.js and Google Fonts.
- The page runs in a sandboxed iframe (allow-scripts only): do not use localStorage, sessionStorage, cookies, alert or window.top.
- Declare each identifier once. Inside one calculation, never reuse a shared scratch vector for two values that are both still needed; use local vectors.
- Guard every animated value against NaN. Cap the pixel ratio at 2. Dispose of the old thread geometries when they are rebuilt. Keep it smooth, at about 60 fps on a laptop. No console errors.
- Answer with the complete file exactly once, in a single ```html code block: no drafts, partial snippets or notes.

Keep planning brief and write the code. Aim for roughly 800 to 1,100 lines, compact and well structured.