Sprout

Sprout is a small language for games and simulations. It runs in your browser, on a phone as well as a desk, and you can change a program while it runs.

Open the editor →

A taste

-- a cell: inputs | body
double : [n | n * 2]
[3, 1, 4] collect double print
-- prints [6, 2, 8]

-- math reads left to right
2 + 3 * 4 print
-- prints 20

-- with makes a new record
p : [x : 1, y : 2]
p with [x : 5] print
-- prints [x : 5, y : 2]

And the brain of every turret in Swarm, which you can change while they fire:

turret-program : [t |
  want : t dy atan2 (t dx)
  off : wrap (want - (t aim))
  [turn : clamp [off * 6, -1, 1], fire : (t far < reach) and (t cool <= 0) and (off abs < 0.06)]
]

Ideas

Try

Read