Chipgrid / Documentation / Guides
Movers and routes
Arrows that travel, emitters that launch them, rails, loops and switches, so the layout of the code becomes the rhythm.
Movers
> < ^ v are movers. Every tick, a mover goes one cell in its direction. When
the next cell is not empty, it stops and turns into a bang where it is. If that bang
touches a voice, the voice plays.
E is an emitter: every N ticks (its left input) it launches a > to its right. The
distance between the emitter and what the arrow hits is a delay:
4E......P4C24
Polyrhythm
Emitters with different periods drift in and out of phase. From the example Movers & polyrhythm:
8E..................P5C02
...................F4
6E..................P5G02
...................F7
cE..................N010
...................Fb
aE..................B3C2o
...................F2
Lanes every 8, 6, 12 (c) and 10 (a) ticks. The bang each arrow turns into also touches
the F below it, so each lane flashes the screen in its own colour.
Rails
_ and | are rails. They do nothing by themselves: a mover rides over them, and the
rail comes back behind it. _ and | are the same thing, one for horizontal tracks and
one for vertical ones. They make your tracks visible even when nothing is playing.
Loops
) turns a mover to its right, ( to its left, from any side. A turn has no input, so all
four of its sides stay free, and a track can close into a loop: four turns, some rails
and one arrow, and it goes round forever.
As the mover goes round a turn, everything touching that turn gets a bang (from the left, above or below). Put voices around the turns and the loop is a sequencer you can see:
)>_____)P5C14
|......|
|......|
)______)
B2C2
This loop is 7 cells wide and 3 tall, counted from turn to turn, so one lap takes
2 × (7 + 3) − 4 = 16 ticks: exactly one bar. P plays as the arrow goes round the top
right turn, B half a bar later at the bottom left. Type a second > on the rails for
twice as many hits. Use ) for loops that run clockwise and ( for loops that run the
other way: side by side they make mirror images.
Switches
: is a switch. A mover reaching it from the left, the top or the bottom leaves the
way the cell on its right says: ^ up, v down, < left, > right, or empty for
straight on.
........P4C24
........|
........|
8E______:^
Every 8 ticks an arrow rides the rails, turns up at the switch, and stops under P: a
bang. Change ^ into v and the arrows go down instead.
The switch’s cell also takes numbers: 0 left, 1 right, 2 up, 3 down. So a clock,
a sequence or a link can change the route
while it plays:
8C2
..S^v
...@r
........P4C24
........|
........|&r
8E______:
........|
........|
........B2C2
A clock walks the list ^v and sends it on the link r. &r writes it into the switch:
one stream of arrows, two voices, taking turns.
Two rules: leave at least one empty cell between a switch and a voice (the mover needs a tick to turn into a bang), and if the way out is blocked, the mover stops and bangs where it is.
Keeping track
- reset puts every mover back where you typed it and clears the screen, without touching your code. Use it when arrows have piled up or gone astray.
- Select a whole loop by dragging across it, then drag the selection (or Ctrl + arrows): the code moves in one piece.
- The Routes examples build trains, routers and effect boards; Code as art lays out whole programs as pictures, with wheels of rails.