← labopen marble run →

Marble Run

Twelve marbles behind a gate at the top of a wide, sloping board. They're already alive: set down by hand, a hair differently each time, they roll to the gate and settle against it, knocking, each with its name beside it. Tap one and it's yours; go lifts the gate, and down board after board of obstacles they go, bumping, parting, catching up, to a funnel at the end that brings them to a single gap, the chequered line across it, and a channel beyond, one marble wide. They come to rest in it in the order they crossed, first at the top: the result is there to see. A chase camera follows yours. There's no wall behind the gate, so a drag swings the view round the row to look down the run from behind it. Past the line is build mode: three boards on offer; pick one and the run grows downward.

The race

TouchMouse and keys
make a marble yourstap it, or its dot in the orderclick
go (from the lineup) / again (back to the gate)the dark button, or tap the board when lined upspace
the camera: yours, the leader, the finishthe light button beside itC
look rounddragdrag
come closepinchthe wheel

build swaps those two buttons for building's three: add it, undo, and try it, which races just the last board, the camera on the leader, to see how it runs. The three boards on offer are cards, each with a little drawing of the board from above; the one chosen is built in place at the end of the run, solid, with the finish moved on after it, so the run is seen whole as it would be. A line of help shows for a moment at each change and then gets out of the way.

The row across the top is the order, first on the left: yours is the big one, named, and the ones in are ringed; tap any to follow it. The clock beside it has your place and your gap. Nothing else sits over the board. As each marble crosses the line its place, name and time fade in beside it, to the right of the channel, which is barely wider than a marble, so the file is straight. A marble that has come to rest there sleeps (it stays put, a stone for the next to stop against, unless knocked hard), so the file settles in under a second; and once the first is in, a straggler stuck on the run is waited for 25 seconds and no longer. The marbles are a roster, as a tournament's: all glass and all the same size, so the run and the knocks decide it and not the marble; each its own look (a cat's eye, a swirl, speckled, banded), its own colours, its own name. The pattern is in the glass, so it turns as the marble rolls.

The solver is deterministic, so the same start would be the same race every time, the same marble first: so each race is its own. Where each marble starts differs by a hair, as a hand setting them out would differ, and from there the knocks decide it; over a dozen races of one run the winner changes, though a lane can be a lucky one.

The solver knows other materials too (physics.ts: steel, wood, rubber, with their densities, bounce, grip and rolling resistance), and the tests race them; the roster is glass.

Building

build flies to the end of the run, where three boards are on offer as cards, each with a little drawing of the board from above; the one chosen is built in place, solid, with the finish moved on after it. add it and the run is one longer; three more offers others; undo takes the last off; try it races just the last board.

There are twenty-two kinds. The fields, 48 wide and walled at the sides: pegs, deflectors (slats and curved slats), a splitter, a chicane, spinners (turning crosses on axles, belted to a motor), gates (rows of chevrons), bumpers, a zigzag, a maze (a weave of short slanted strips, one in four left out), a slalom (pairs of poles left and right, a guide strip toward each), a straight; and a mixed board, two fields one after the other. The shapes: a funnel, a step down, stairs (three short flights), a bend and a hairpin (the board sweeps round by up to 120°, bumpers on the outside), a steep ramp into a run-out, a jump (a lip that kicks up, a gap, and a lower board reaching back under it to land on), a bridge (the run narrows onto a span of slats between clear panels, posts and a rail), a causeway (a narrow paved way that curves), and a tunnel (a Perspex or cardboard lid over part of the board). About a third of the other boards turn a little too.

Some strips are Perspex. Boards carry worn stickers (stars, dots, arrows, stripes, faces, hearts, scuffed through and peeling) and tape: across a side, or over the top of a strip where it was mended. Nothing on a board stands square to the slope: whatever a marble meets, it slides off to one side or the other, as on a real board.

The run is its seed and your choices, in the address (?seed=…&run=0.2.1.…): share it, and it is the same run for anyone. new run starts another seed. ?marble=Dusk makes that one yours.

Themes

atelier is the workshop: kraft-paper boards on taped boxes and cords, bunting, daylight by the window. nocturne is an observatory at night: ink-blue lacquer with a star chart drawn in gold, brass-bound strips and brass pegs, dark oak posts, the moon low in the windows and the pendant lamps lit. The theme is where the run is and what it's made of (theme.ts): the key light, the room's colours, the lamps, the material of every part (colour, roughness, metalness, and a style: paper fibre, corrugation, lacquer, brushed brass, oak, leather, planks, stone, glaze, chart), the supports, what stands about, the haze and the dust. The course, the physics, the race and the camera know nothing of it: tap atelier/nocturne under a race and the race goes on exactly as it was, in another place. The scenery's randomness has its own seed, so it never changes the course. ?theme=nocturne in the address.

The solver

Rigid spheres with spin, in centimetres and seconds, in many small steps. Each step a marble falls a little, then every contact it has is resolved: a normal impulse with restitution (none when it's barely moving, so it rests), a friction impulse against the grip's limit that also spins it (which is what makes it roll, and what a spinning marble does when it lands), and the overlap pushed out. Rolling resistance slows what rolls, and the board's roughness takes more the faster it goes. A solid sphere rolling down a slope gathers speed at five sevenths of what a sliding one would, and does here.

A board is a floor, its two sides, and what's stuck on it: walls (segments, met as capsules), pegs (cylinders), spinners (arms turning about an axle, whose own speed at the point of contact counts in the bounce and the grip). The floor is cardboard, dull and grippy; the strips are smoother, so a marble slides down a slanted one rather than resting against it. Nothing on a board stands square to the slope, and a wall that reaches a side meets it (a gap there wedges a marble); a marble that stops anyway is nudged sideways, and the board under it is tapped: it and its neighbours hop a little, each its own way, which breaks an arch of marbles jammed across a narrow gap as no push from one side can. After a push between marbles the board has the last word, so the pack can't press one through a wall; below a step the sides reach up to the board above. Marbles meet each other with restitution and friction between their materials, mass-weighted; twelve of them on one board is most of the race.

A bent board sweeps its frame round a circle: its middle an arc of its length, turning by its turn, dropping at its slope. Everything on it is placed by (along, up, across) and bends with it, the drawing and the solver alike: the floor and sides in pieces, the walls as bent polylines in the world; a marble's own (along, up, across) is found from its bearing about the centre of the turn, brought down to the floor first since the floor's normal leans with the slope.

Notes