Chipgrid / Documentation / Examples

Little worlds

Small complete scenes with sound and picture together.

12 examples. Each block is the grid as the app loads it (a . is an empty cell). Open in Chipgrid opens it ready to play; or pick it from the app’s EXAMPLES menu.

Fireworks

Two rockets climb their rails. At the top each one bangs a gate: a ring appears at a random place, in a random colour, with a bang in the noise channel. +20 pushes the whole picture outward and T1 dissolves it, and that is the explosion. Rockets leave every 16 and 24 ticks, so the show never quite repeats.

# FIREWORKS #
.
.
+20
T1
.
.
.
...............0Rv1Rf
..............?Q.82
..............|N90
..............|..............0Rv1Rf
..............|.............?Q.52
..............|.............|N70
..............|.............|
..............|.............|
..............|.............|
..............|.............|
..............|.............|
..............|.............|
gE____________:^............|
............................|
............................|
oE__________________________:^

Open in Chipgrid ↗ · 120 BPM

Heartbeat

Two beats close together, then a long silence: the pattern *00*000…. The bang travels on the link h, to a low kick and to a gate that draws your heart, the sprite in the code. Below, a second sequence holds the shape of a cardiogram, and a clock sweeps it across the screen, like a hospital monitor. Edit the numbers and change its shape.

# HEARTBEAT #
.
.1Cg......................&h
...S*00*000000000000.......?$ca86
....@h.......................22..22
............&h..............22222222
.............B1C3...........21222222
.............................222222
..............................2222
...............................22
.
1Cw
..Y33
....1Cg
......Sccccc9fcccccccccc
....X..1# the trace sweeps across #
.
T2

Open in Chipgrid ↗ · 90 BPM

Day and night

A whole landscape, with no animation code: a slow clock flips between two values, and S turns them into a sky colour, a star colour and a sun colour. By day the stars are the colour of the sky, so you can’t see them, which is how it really works. gWv swings the sun across once per day.

# DAY AND NIGHT #
.
wC2
..S80...# the sky: blue, then black #
V0
.
wC2
..S81...# stars: white at night, hidden by day #
Ug
...wC2
.gWv.S41
.Q.63.....# sun, then moon #
.
H0kw6
H0lw6
H0mw6
H0nw6
O4e57
Oqe73
T9
.
..gC4
1D2.SCAFG
..B2.2

Open in Chipgrid ↗ · 110 BPM

Singing face

It sings along. I0 listens to the first voice and writes how loud it is. S turns that into a mouth size, so the mouth opens on each note and closes as it fades. Change the melody, or the length of the notes, and watch how it changes the way it sings.

# SINGING FACE #
.
...I0
....S0011122233344
.Qgg.1..# its mouth opens as loud as the note #
.
Qgcb4
Xb91
Xl91
T9
V0
.
.
..8C4
1D8.SCEGA
..P4.28

Open in Chipgrid ↗ · 110 BPM

Breakout

A game that plays itself. The ball is one pixel whose x and y are two waves of different speeds, so it never repeats its path soon. The racket reads the same wave as the ball, so it never misses. Each wave has a beat with the same period, which is why you hear a bleep at every bounce. Change 3Wn to make the ball faster.

# BREAKOUT #
.
3Wn
..Y13
.
.4Wv
.X..7...# the ball: two waves #
.
.
.4Wv
.H.n61..# the racket follows it #
.
H01w2
H02w4
H03w8
T8
.
1D6.........1D8
..P5C02........N010

Open in Chipgrid ↗ · 130 BPM

String art

One single straight line. Its two ends slide along the edges on two waves, half a cycle apart, and the line keeps its old positions on screen for a moment: the straight lines build a curve, as with nails and thread. Z2 mirrors it into a star, % slides the colours. Try changing the phase i.

# STRING ART #
.
2Wv.2Wni
L.00.7..# one line, its ends on two waves #
.
Z2
T1
.
4Cg
%
.
.
..gC4
1D4.SCAFG
..G3.24

Open in Chipgrid ↗ · 100 BPM

Typewriter

A letter every beat, with the sound of the keys. Two sequences walk together: one holds the message, the other the position of each letter on the line. Y carries the letter over to the text operator, which only writes when its gate is banged. After 16 letters, K turns the page. Write your own sentence, 16 characters, with _ for spaces.

# TYPEWRITER #
.
4Cg
..SCODE_IS_ALSO_ART
...Y54
.1D4
...4Cg
..J..S02468acegikmoqsu
...?".c1
..N010
2Dw
..K

Open in Chipgrid ↗ · 110 BPM

Living code

Look at the melody in the code: two of its notes keep changing by themselves. The two Y write random numbers straight into the sequence, so the program is editing its own score while it plays. The other notes hold it together. Below, every note is drawn as a piano roll, so you see what it decides.

# LIVING CODE #
.
0R70R7
..Y62Y62....# these rewrite the notes below #
...2C8
.1D2.S02457024
...P4.12
.....J
...Xv.4
.
M05

Open in Chipgrid ↗ · 124 BPM

Aquarium

Three layers, each with its own job. At the back, a gradient of water. In the middle, bubbles: U sprinkles pixels and M21 lets them rise. In front, two fish swim on two waves of different speeds, so they keep passing each other. The seed picks the fish: try other numbers.

# AQUARIUM #
.
V0
~6.472..# water #
.
[1
M21.....# bubbles rising #
U11
T1
.
[2
]2
T9
8Wr
O.a54...# two fish, on waves #
5Wr
O.g93
.
.
.
..gC4
1D4.SCAFG
..G3.24

Open in Chipgrid ↗ · 96 BPM

Snowfall

The house in the code is the house on the screen, three times bigger. Change a digit and you repaint it. The snow is one pixel at a random x, on the top row, and M33 lets it fall, on a layer of its own, so it never touches the house. Two soft notes are the only sound.

# SNOWFALL #
.
V0
~6.4f2
.
[1
M33
.
.0Rv....# snow, falling on its own layer #
.X.01
.
[2
]3
$9ea8.......H0nw1
....22
...2222
..222222............1Dg
.22222222.............P6C04
.dddddddd
.d44dd44d...........1Dw
.dddddddd.............P6G08
.dd.11.dd

Open in Chipgrid ↗ · 90 BPM

City at night

Look at the grid: the skyline is written in digits. f is the wall, 4 a lit window, and ]5 makes it fill the screen. Two sequences use Y to write into the drawing, so the code changes its own picture and windows go on and off. At the bottom, the headlights of a car every half bar.

# CITY AT NIGHT #
.
8C6.....V0..~6.4f2
..S4f44f4
...Y58
5C5
..S4ff4f
...Ya4..]5
....$48g8
........ff......ff
........f4..ff..f4
.....ff.ff..f4..ff
.....f4.f4.fffffff
....ffffffff4f4f4fff
....f4f4ffffffffffff
....ffffff4f4f4ff4ff
....ffffffffffffffff
.
[2.]1
M05.......................gC4
1D8.....................1D2.SCAFG
..?Xvn4...................B2.2
.
# the skyline is the code; two windows blink #

Open in Chipgrid ↗ · 84 BPM

Campfire

No flame is drawn here. Three pixels appear at random along the logs, in orange, yellow and red. M22 lifts everything, T1 eats away at it, = makes it sway. What you see as fire is the sum of those small rules. The noise channel crackles along.

# CAMPFIRE #
.
V0..[0.U1c.T6..# stars #
.
[1
M22
T1...# sparks rise, die away and sway #
=24
.
.cRk
.X.n3
.dRj
.X.n4
.bRl
.X.n2
.
[2
Hbn8e
Hdm4e
.
1D5
..N020

Open in Chipgrid ↗ · 150 BPM

Esc