The standard library: 67 modules, 601 words, written in Sprout. And 2 kits that draw, and 9 wrapped libraries.
Each module is a cell whose fields are its words, there in every program: ease out-cubic 0.5, stats median xs, grid path [g, from, to, open]. The source is in lib/, one file a module, and is worth reading: every word is a few lines.
One way of working runs through all of them. A point, a size, a cell of a grid and a hex are pairs, like 3x4, read with p x and p y, and added and scaled like numbers. A word's inputs come in the same order: what it works on, then how, then the time or the seed. Randomness only ever comes from a seed, through seeded, so a game that rewinds, and a second phone playing along, get the same luck. And every example below shows its answer, which is worked out, and checked, each time the library is built.
Built into every value as well: the list, record, text and number words, endless lists, the literals, parse, quote and script. They are in the spec (decisions 99 to 104).
Words and numbers
format
Numbers and text made ready to show.
format commas [n]
a whole number with commas between the thousands
format commas 1234567
-- 1,234,567
format places [n, count]
a number with a fixed number of places after the point
format places [3.14159, 2]
-- 3.14
format percent [x]
a share from 0 to 1 as a percent
format percent 0.256
-- 26%
format ordinal [n]
1st, 2nd, 3rd, 4th ... 11th, 12th, 13th, 21st
format ordinal 22
-- 22nd
format plural [n, word]
a count and a word, with an s when there isn't exactly one
format plural [3, "apple"]
-- 3 apples
format clock [seconds]
seconds as m:ss, or h:mm:ss past an hour
format clock 3725
-- 1:02:05
format wrap [words-text, width]
text broken into lines no longer than width, at spaces
format wrap ["the quick brown fox jumps over the lazy dog", 12]
-- [the quick, brown fox, jumps over, the lazy dog]
format centre [line, width]
text in the middle of a line width wide
format centre ["hi", 6] replace-all [" ", "."]
-- ..hi..
format title [line]
Every Word Capitalized
format title "the sprout standard library"
-- The Sprout Standard Library
format bar [value, most, width]
a bar of blocks, value out of most, width wide
format bar [3, 4, 8]
-- ######..
format short [n]
a number short enough to read at a glance: 1.2K, 3.4M, 5.6B, 7.8T (idle and tycoon games)
format short 1234567
-- 1.2M
prose
Text tools: slugs and cases for names in code and links, initials, cutting text short, lists and numbers written in English, how far apart two words are, palindromes, sentences and syllables.
prose slug [line]
text made fit for a web address: lower case, words joined by hyphens
prose reverse-words "one two three"
-- three two one
prose sentences [line]
text split into sentences
prose sentences "Hi. How are you? Fine!"
-- [Hi., How are you?, Fine!]
prose syllables [word]
about how many syllables a word has (a count of its vowel sounds)
prose syllables "beautiful"
-- 3
prose syllables "table"
-- 2
integers
Whole numbers: common factors and multiples, primes, digits, factorials and choosing, Fibonacci and triangle numbers, Roman numerals and other bases. For number puzzles, quizzes and teaching games.
integers finite [n]
is n a number that ends (not text, not endless, not the answer to 0 / 0)? The words that go round until they reach an answer ask first, so they stop
integers finite 12
-- true
integers finite (1 / 0)
-- false
integers gcd [a, b]
the greatest common divisor: the largest number that divides both
integers gcd [12, 18]
-- 6
integers lcm [a, b]
the least common multiple: the smallest number both divide
the digits added again and again until one is left
integers digital-root 4096
-- 1
integers factorial [n]
n factorial: 1 × 2 × … × n
integers factorial 5
-- 120
integers choose [n, k]
how many ways there are to choose k things from n, in any order
integers choose [5, 2]
-- 10
integers choose [52, 5]
-- 2598960
integers fibonacci [n]
the nth Fibonacci number: 1, 1, 2, 3, 5, 8, each the sum of the two before
integers fibonacci 10
-- 55
integers triangle [n]
the nth triangle number: 1 + 2 + … + n
integers triangle 10
-- 55
integers square [n]
is n a whole number squared?
integers square 49
-- true
integers collatz [n]
how many steps n takes to reach 1, halving when even, else three times plus one
integers collatz 27
-- 111
integers roman [n]
n in Roman numerals
integers roman 2026
-- MMXXVI
integers roman 1994
-- MCMXCIV
integers from-roman [numeral]
the number a Roman numeral stands for
integers from-roman "MCMXCIV"
-- 1994
integers to-base [n, base]
n written in a base from 2 to 36
integers to-base [255, 16]
-- ff
integers to-base [10, 2]
-- 1010
integers from-base [digits-text, base]
the number a text in a base stands for
integers from-base ["ff", 16]
-- 255
span
Ranges written as pairs, low x high (0x10 runs from 0 to 10): keeping a value inside one, where a value sits in one, carrying a value from one range to another, wrapping, snapping and fading. For sliders, health bars, scrolling, volume and anything kept within bounds.
span clamp [value, bounds]
value kept inside bounds
span clamp [12, 0x10]
-- 10
span mix [bounds, t]
the value a share t of the way through bounds (0 is low, 1 is high)
span mix [0x10, 0.25]
-- 2.5
span where [value, bounds]
how far through bounds value is: 0 at low, 1 at high
span where [2.5, 0x10]
-- 0.25
span remap [value, from, to]
value carried from one range to another: the same share of the way through
span remap [5, 0x10, 0x100]
-- 50
span remap [25, 0x100, 1x0]
-- 0.75
span wrap [value, bounds]
value wrapped round inside bounds, as an angle wraps round a circle
span wrap [12, 0x10]
-- 2
span wrap [-1, 0x10]
-- 9
span bounce [value, bounds]
value bounced back and forth between the ends of bounds
span bounce [12, 0x10]
-- 8
span snap [value, step]
value moved to the nearest multiple of step
span snap [7.3, 0.5]
-- 7.5
span nearest [value, choices]
the choice nearest value
span nearest [12, [0, 10, 25]]
-- 10
span holds [bounds, value]
does bounds hold value, ends included?
span holds [0x10, 10]
-- true
span width [bounds]
how wide bounds is
span width 2x7
-- 5
span overlap [a, b]
the part two ranges share, or false if they don't meet
span overlap [0x5, 3x8]
-- 3x5
span overlap [0x2, 3x8]
-- false
span steps [bounds, n]
n + 1 evenly spaced values from low to high
span steps [0x10, 4]
-- [0, 2.5, 5, 7.5, 10]
span fade [value, bounds]
0 below bounds, 1 above, and a smooth climb between (smoothstep)
span fade [2.5, 0x10]
-- 0.15625
measure
Units and conversions between them: lengths, weights, volumes, areas, times, speeds and sizes of data, with temperatures and angles. A unit is a short name such as "km", "mi", "lb", "cup" or "km/h"; cups, pints and gallons are American, "uk-pt" and "uk-gal" British. Each unit is kept as its name, how many of the kind's base unit it is (metres, kilograms, litres, square metres, seconds, metres a second, bytes) and what it measures.
measure convert [value, from, to]
value in one unit turned into another of the same kind (false if they measure different things)
measure convert [10, "km", "mi"]
-- 6.2137119224
measure convert [2, "cup", "ml"]
-- 473.176473
measure convert [1, "kg", "km"]
-- false
measure kind-of [unit]
what a unit measures
measure kind-of "knot"
-- speed
measure units [kind]
the units for one kind of thing, smallest first, for a picker
measure units "length"
-- [mm, cm, m, km, in, ft, yd, mi, nmi]
measure temperature [value, from, to]
a temperature turned from one scale to another: "C", "F" or "K"
measure temperature [100, "C", "F"]
-- 212
measure temperature [-40, "F", "C"]
-- -40
measure degrees [radians]
an angle in radians turned to degrees
measure degrees pi
-- 180
measure radians [angle]
an angle in degrees turned to radians
measure radians 90
-- 1.5707963268
measure bytes [n]
a size in bytes, as people read it
measure bytes 1536
-- 1.5 KB
measure bytes 3221225472
-- 3 GB
measure duration [seconds]
a length of time in hours, minutes and seconds, leaving out what's zero
measure duration 3725
-- 1h 2m 5s
measure duration 7200
-- 2h
measure pace [distance, seconds]
a running pace: minutes and seconds for each km (or mile) at distance covered in seconds
measure pace [5, 1650]
-- 5:30
stats
Numbers that sum up a list of numbers.
stats mean [xs]
the average
stats mean [2, 4, 9]
-- 5
stats median [xs]
the middle value once they are sorted (the average of the two middle ones for an even count)
stats median [7, 1, 3, 9]
-- 5
stats mode [xs]
the value that comes up most often (the first of them, if several tie)
stats mode [3, 1, 3, 2, 1, 3]
-- 3
stats variance [xs]
how spread out the values are: the mean of the squared distances from the mean
stats variance [2, 4, 4, 4, 5, 5, 7, 9]
-- 4
stats spread [xs]
the standard deviation: the square root of the variance
stats spread [2, 4, 4, 4, 5, 5, 7, 9]
-- 2
stats percentile [xs, p]
the value below which a share p of them fall, from 0 to 1 (between two values, part of the way)
stats summary [3, 1, 4, 1, 5, 9, 2, 6]
-- [n : 8, mean : 3.875, median : 3.5, spread : 2.571, smallest : 1, largest : 9]
Apps and data
stack
An app as a stack of cards, after HyperCard: each card a record with a name and its fields, and the stack [cards : [...], at : 1] knows which card is showing. Go to the next or the previous card (round the ends), the first, the last or one by name; find words on any card after this one; put a value into a field of the card showing; and add a card after it. For address books, quizzes, recipes and little databases.
stack card [book]
the card showing
stack card [cards : [[name : "home"], [name : "map"]], at : 2] name
-- map
stack go [book, where]
the stack moved to the "next", "previous", "first" or "last" card, or to the card of that name
stack go [[cards : [[name : "a"], [name : "b"]], at : 2], "next"] at
-- 1
stack go [[cards : [[name : "a"], [name : "b"], [name : "c"]], at : 1], "previous"] at
-- 3
stack go [[cards : [[name : "a"], [name : "b"], [name : "c"]], at : 1], "c"] at
-- 3
stack find [book, words]
the stack moved to the first card after this one, going round, with the words in any of its fields; where it was if none has them
stack find [[cards : [[name : "a", note : "milk"], [name : "b", note : "eggs and ham"]], at : 1], "ham"] at
-- 2
stack put [book, field, value]
the stack with a value put into a field of the card showing
stack card (stack put [[cards : [[name : "a"]], at : 1], "note", "hi"]) note
-- hi
stack add [book, new-card]
the stack with a card added after the one showing, which it then shows
Dates for apps: how long months are, leap years, a month laid out in weeks for a calendar view, weeks of the year, ages, how long ago something was, the nth weekday of a month, repeating events and Easter. Dates are Sprout's own (2026-11-20), and weeks start on Monday.
calendar leap [year]
is year a leap year?
calendar leap 2024
-- true
calendar leap 1900
-- false
calendar days-in [year, month]
how many days a month has
calendar days-in [2026, 2]
-- 28
calendar days-in [2024, 2]
-- 29
calendar parts [when]
a date's year, month and day
calendar parts 2026-11-20
-- [year : 2026, month : 11, day : 20]
calendar month-name [m]
the name of a month, from its number
calendar month-name 11
-- November
calendar weekday-number [when]
a date's weekday as a number, Monday 1 to Sunday 7
calendar weekday-number 2026-11-20
-- 5
calendar month [year, m]
the weeks of a month, for a calendar view: lists of seven days, Monday first, false where a day belongs to the month before or after
calendar written 2026-11-20
-- Friday 20 November 2026
finance
Money over time: what a loan costs each month and how it's paid off, savings that compound, how long money takes to double, changes in percent, tax, tips and fair shares, break-even points and what an investment is worth. Rates are shares (0.05 is 5% a year); the answers are numbers, ready for format places.
finance payment [principal, yearly-rate, months]
the monthly payment that pays off a loan over a number of months
finance payment [200000, 0.06, 360] round
-- 1199
finance schedule [principal, yearly-rate, months]
each month of a loan: the interest, what was paid off and what is still owed
Tables kept as lists of records, one record a row, the way a spreadsheet or a database holds them: a column's values, picking columns, sorting and filtering, totals, counts and averages by group, the top rows, joining two tables, a pivot, and the whole table as aligned text. Columns are named by text, such as "region".
rows made from a list of column names and lists of values
tabular records [["name", "age"], [["Ada", 36], ["Alan", 41]]]
-- [[name : Ada, age : 36], [name : Alan, age : 41]]
tabular show [rows]
the table as aligned text: a header, a rule, then a line a row, numbers lined up on the right
tabular show (tabular pick [tabular sample, ["region", "sold"]] take 2)
-- region sold
-- ------ ----
-- north 12
-- south 7
graph
Things joined by arrows: tasks and the tasks they lead to, rooms and their doors, pages and their links. A graph is a list of edges, each [from, to], or [from, to, cost] when an edge has a cost; a node is any text or number. Find what a node leads to and what leads to it, an order to do things in, the way from one node to another, the cheapest and the longest way, and a loop when there is one.
graph nodes [edges]
every node, in the order the edges first name them
every node in an order where each comes after all the nodes that lead to it, or false when a loop makes that impossible (an order to do tasks in, to load files in, to learn skills in)
the longest way through a graph with no loops, each node counting for what weight gives it: [way, total], or false when there's a loop (with each task's days as its weight, a project's critical path)
Lists used as sets, where what matters is which things are in, not their order or how often. Each answer keeps the order of the first list and holds each thing once. And the ways to choose some of the things, or to order them.
sets union [a, b]
every thing in either list
sets union [[1, 2, 3], [3, 4]]
-- [1, 2, 3, 4]
sets both [a, b]
the things in both lists
sets both [[1, 2, 3], [4, 3, 2]]
-- [2, 3]
sets minus [a, b]
the things in the first list that aren't in the second
sets minus [[1, 2, 3, 2], [2]]
-- [1, 3]
sets toggle [items, thing]
the list with a thing taken out when it's in, or added when it isn't (a tag, a selected tile, a crew's members)
sets toggle [["a", "b"], "a"]
-- [b]
sets toggle [["b"], "a"]
-- [b, a]
sets inside [a, b]
is everything in the first list also in the second?
sets inside [[1, 2], [3, 2, 1]]
-- true
sets inside [[1, 4], [3, 2, 1]]
-- false
sets same [a, b]
do two lists hold the same things, in any order?
sets same [[1, 2, 2], [2, 1]]
-- true
sets picks [items, n]
every way to choose n of the things, each in the list's order (hands of cards, teams, pairs to compare)
Finding what someone meant from what they typed. A search matches a name when its letters appear in the name in order; matches score higher for letters side by side and at the starts of words, as a command palette or a file finder ranks them. And the closest spelling, for "did you mean?".
fuzzy score [search, name]
how well a search matches a name: 0 when its letters don't all appear in order, more for runs and word starts
Checks on what people type, before it's used: email and web addresses, card numbers and ISBNs with their check digits, numbers, real dates, phone numbers, colour codes, IP addresses, usernames, lengths and how strong a password is. Each answers true or false, except password-gaps, which says what a password still needs.
validate email [line]
does text look like an email address?
validate email "ada@example.com"
-- true
validate email "ada@example"
-- false
validate luhn [line]
does a card number pass the Luhn check? Spaces and dashes are ignored
validate luhn "4111 1111 1111 1111"
-- true
validate luhn "4111 1111 1111 1112"
-- false
validate isbn [line]
is text an ISBN, 10 or 13 digits long, with the right check digit? Dashes and spaces are ignored
validate isbn "978-0-306-40615-7"
-- true
validate isbn "0-306-40615-2"
-- true
validate isbn "0-306-40615-3"
-- false
validate url [line]
does text look like a web address, http or https, with a host?
does text look like a phone number: 8 to 15 digits, with spaces, dashes, brackets or a leading +?
validate phone "+61 412 345 678"
-- true
validate colour-code [line]
is text a colour written #rgb or #rrggbb?
validate colour-code "#ff8800"
-- true
validate colour-code "#ff88"
-- false
validate ip [line]
is text an IP address: four numbers from 0 to 255, with dots between?
validate ip "192.168.0.1"
-- true
validate ip "256.1.1.1"
-- false
validate username [line]
is text a username: 3 to 20 letters, digits or underscores, starting with a letter?
validate username "ada_99"
-- true
validate username "9lives"
-- false
validate filled [line]
is something filled in: not empty and not only spaces?
validate filled " "
-- false
validate fits [line, bounds]
is text's length within bounds, a pair of fewest x most?
validate fits ["Ada", 3x20]
-- true
validate password-gaps [secret]
what a password still needs to be strong, in words; nothing when it's strong
validate password-gaps "hunter2"
-- [at least 12 characters, a capital letter, a symbol]
validate password-gaps "Correct-Horse-7"
-- []
validate strong [secret]
is a password strong, needing nothing more?
validate strong "Correct-Horse-7"
-- true
undo
Going back. A history is a list of earlier states, the newest first, as a puzzle, an editor or a drawing keeps them: push the state before each change, and go back one step at a time.
undo push [history, state, most]
the history with a state put on top, keeping at most most of them
undo push [[2, 1], 3, 10]
-- [3, 2, 1]
undo push [[2, 1], 3, 2]
-- [3, 2]
undo peek [history]
the state that going back would give (false when there's none)
undo peek [3, 2, 1]
-- 3
undo peek []
-- false
undo pop [history]
the history without the state on top
undo pop [3, 2, 1]
-- [2, 1]
undo can [history]
is there anything to go back to?
undo can []
-- false
undo back [history, current]
one step back from the state now: [state, history], the state now kept when there's nothing to go back to
undo back [[3, 2, 1], 9]
-- [state : 3, history : [2, 1]]
undo back [[], 9]
-- [state : 9, history : []]
csv
Tables in text, one row a line and commas between the values. The first line names the columns. Values that look like numbers become numbers. A value in double quotes can hold commas, and "" inside it is one quote, as spreadsheets write them. (A value can't run over more than one line.)
csv cell-value [t]
one value from text: a number if it looks like one
csv fields [line]
one line's values: split at the commas outside quotes, with the quotes taken off
Little trees of data written as an indented outline, after the data language of _why's Potion. Each line is a name and its words (a word that is a number reads as one); the lines indented under it are its kids.
lick read
an outline into a list of nodes, each [name, words, kids]
Easing curves for animation. Each takes t, from 0 to 1, and gives a value that starts at 0 and ends at 1. Use one to move something smoothly: x : ease out-cubic (motion progress [2, elapsed]) * 300, or motion tween.
ease linear [t]
straight along, at one speed
ease linear 0.25
-- 0.25
ease in-quad [t]
starts slow, speeds up
ease in-quad 0.5
-- 0.25
ease out-quad [t]
starts fast, slows down
ease out-quad 0.5
-- 0.75
ease in-out-quad [t]
slow at both ends
ease in-out-quad 0.25
-- 0.125
ease in-cubic [t]
starts slower still
ease in-cubic 0.5
-- 0.125
ease out-cubic [t]
arrives gently: the usual choice for things that slide into place
ease out-cubic 0.5
-- 0.875
ease in-out-cubic [t]
slow at both ends, more so than in-out-quad
ease in-out-cubic 0.75
-- 0.9375
ease out-back [t]
goes a little past the end, then settles back
ease out-back 0.8
-- 1.04645056
ease out-elastic [t]
springs past the end and wobbles to a stop
ease out-elastic 0.3
-- 0.875
ease out-bounce [t]
bounces like a dropped ball
ease out-bounce 0.9
-- 0.988125
ease smooth [t]
a soft S-curve, slow at both ends
ease smooth 0.25
-- 0.15625
ease ping-pong [t]
t from 0 to 1 and back again, for things that go to and fro
ease ping-pong 1.25
-- 0.75
motion
How things move and how a game feels: how far through something is, tweens, glides, shake, bobbing, gravity and bounces. A body is [at, speed], both pairs (where it is, and how far it goes a second). Each word works from the time or the step, so a game can rewind and replay. Distilled from the TaskIAP games: 112 of the 319 ease things about, 57 have gravity, 55 shake the screen.
motion progress [length, elapsed]
how far through something length seconds long is, from 0 to 1, elapsed seconds in
motion progress [2, 1.5]
-- 0.75
motion tween [a, b, start, length, curve, now]
a value (or a point) going from a to b over length seconds from start, shaped by an easing curve: where it is at now
a speed after dt seconds of friction, keeping share of itself every second
motion drag [10, 0.5, 1]
-- 5
motion jump-speed [height, g]
how fast to jump to rise to height under gravity g
motion jump-speed [2, 9.8] round
-- 6
arc
Things thrown through the air, a ball at a hoop, a grenade, a leaping frog: where one is along its flight from one point to another, how far through the flight it is, the speed to throw at to land on a spot, and where a thing already flying comes down. Points are pairs, y counts down the screen, and gravity pulls down (a number above 0).
arc point [origin, target, height, t]
where a thing is at fraction t (0 to 1) of its flight from origin to target, rising height above the straight line at the middle
arc point [0x100, 100x100, 40, 0.5]
-- 50x60
arc point [0x100, 100x50, 40, 1]
-- 100x50
arc progress [span, began, now]
how far through a flight of some length it is now, from when it began: 0 before, 1 once it has landed
arc progress [0.8, 2, 2.4]
-- 0.5
arc progress [0.8, 2, 5]
-- 1
arc launch [origin, target, height, gravity]
the speed to throw at, across and up, to land on a target from origin, rising height above origin, under gravity
arc launch [0x100, 80x100, 100, 200]
-- 40x-200
arc landing [origin, speed, gravity, ground]
where a thing thrown from origin at a speed comes back down to the ground (a height on the screen), to run to where a loose ball will land
arc landing [0x100, 40x-200, 200, 100]
-- 80x100
platform
How the hero of a platform game runs and jumps, the way the good ones feel: speeding up and slowing down, gravity with a top falling speed, a jump cut short when the button is let go, a jump still allowed a moment after running off a ledge (coyote time), and a press a moment before landing still counting (the jump buffer). step does a whole frame of it through tilemap move, which keeps the hero out of the walls. Distilled from Sprig and Headstrong.
platform run [speed-x, way, top, accel, brake, dt]
the speed across after a frame of running one way (-1, 0 or 1): speeding up by accel toward top, else slowing by brake
platform run [0, 1, 100, 800, 1000, 0.1]
-- 80
platform run [90, 0, 100, 800, 1000, 0.05]
-- 40
platform run [95, 1, 100, 800, 1000, 0.1]
-- 100
platform fall [speed-y, holding, pull, cut, top, dt]
the speed down after a frame of falling: gravity pulls, a rise is cut to cut when the button isn't held, and it never falls faster than top (up is minus)
platform fall [-300, true, 900, -110, 270, 0.1]
-- -210
platform fall [-300, false, 900, -110, 270, 0.1]
-- -20
platform fall [250, true, 900, -110, 270, 0.1]
-- 270
platform coyote [left-over, grounded, span, dt]
coyote time: how long a jump is still allowed after leaving the ground, full again while standing on it
the jump buffer: how long a press of jump is remembered, so pressing just before landing still jumps
platform buffer [0, true, 0.12, 0.02]
-- 0.12
platform buffer [0.1, false, 0.12, 0.02]
-- 0.08
platform jumps [coyote-left, buffer-left]
does the hero jump now: a press remembered while the ground is under foot, or only just left
platform jumps [0.05, 0.1]
-- true
platform jumps [0, 0.1]
-- false
platform feel
how a hero feels, to change with with: its box, the map's tile and which characters are solid or one-way, running (top speed, speeding up on the ground and in the air, braking), jumping (speed, gravity, the cut, the top fall speed) and the two windows
a hero for one frame: running one way (-1, 0 or 1), jumping when jump was pressed (held for higher), falling, and moved through the map; gives the hero with at, speed, ground, coyote-left, buffer-left and jumped (did it jump now?)
Things that move like they're on a spring: they overshoot, wobble and settle, which makes buttons, cameras and characters feel alive. A spring's state is [at, speed]; at and target can be numbers or pairs. Step it each frame with the time that passed.
spring step [state, target, stiffness, damping, dt]
a spring's state after dt seconds pulled toward target: stiffness pulls harder, damping calms it
a state after dt seconds closing on target as fast as it can without overshooting, taking about smooth-time seconds (a critically damped spring, for cameras and pointers)
spring follow [[at : 0, speed : 0], 10, 0.5, 0.1] at * 100 round / 100
-- 0.62
spring resting [state, target, tolerance]
has a spring come to rest: near its target and hardly moving?
the damping that settles a spring of this stiffness fastest without a wobble
spring critical 100
-- 20
spring wobble [amplitude, frequency, decay, t]
a wobble that dies away: amplitude at the start, frequency times a second, fading at decay a second, t seconds in
spring wobble [1, 2, 3, 0.125]
-- 0.6872892788
spring stretch [speed, most]
squash and stretch from speed: narrower and taller the faster something moves, up to 30%, as a scale across x down
spring stretch [-300, 600]
-- 0.85x1.15
keyframes
Values set at moments, and everything between worked out: the timelines of cutscenes, title screens, moving platforms and lighting. Keys are [time, value] pairs in time order; values can be numbers or pairs, or any value for held and crossed.
keyframes at [track, t]
the value at time t, straight between track, held before the first and after the last
Animation by frames, as sprites flick through a sheet of pictures: which frame shows now, looping, once, back and forth, where a frame sits in a sprite sheet, which way to face and which row of a sheet to use for a direction. Frames count from 1.
flipbook frame [count, fps, now]
the frame showing now, looping through count frames at fps a second
flipbook frame [8, 12, 1.25]
-- 8
flipbook once [count, fps, start, now]
the frame showing now when played once from start, then held on the last
flipbook once [5, 10, 2, 2.35]
-- 4
flipbook done [count, fps, start, now]
has playing once from start finished?
flipbook done [5, 10, 2, 2.6]
-- true
flipbook swing [count, fps, now]
the frame showing now, playing forward then back (1, 2, 3, 4, 3, 2, 1, ...)
which way to face from speed across: 1 right, -1 left, and the way it was when standing still
flipbook facing [-40, 1]
-- -1
flipbook direction [angle, n]
which of n directions an angle points (1 is right, then clockwise on screen), to pick a row of a sheet
flipbook direction [pi / 2, 4]
-- 2
steer
Steering for things that move by themselves: chasing, fleeing, arriving gently, heading off a target, wandering, and the three rules of a flock (keep apart, line up, stay together). A body is [at, speed], both pairs, as in motion. Each word gives a push to add to speed; apply adds it.
Time in a game world: the hour, day and night, the light and sky, weekdays, seasons, and the stages things grow through. Distilled from the TaskIAP games: 59 of the 319 have days and nights or weather, 30 seasons, 18 crops.
daytime hour [day-length, start-hour, now]
the hour (0 up to 24) at now seconds, when a day lasts day-length seconds and starts at start-hour
daytime hour [120, 6, 90]
-- 0
daytime part [h]
the part of the day an hour falls in: night, dawn, day or dusk
daytime part 18.5
-- dusk
daytime light [h]
how light it is at an hour, from 0 at night to 1 by day, rising through dawn and falling through dusk
daytime light 6
-- 0.5
daytime sky [h]
the sky's colour at an hour: deep blue at night, orange at dawn and dusk, blue by day
daytime sky 12
-- #6fa8e8
daytime season [day, length]
the season of a day (day 1 the first of spring), seasons lasting length days
daytime season [40, 28]
-- summer
daytime weekday [day]
the weekday of a day (day 1 a Monday)
daytime weekday 10
-- Wed
daytime stage [planted, lengths, now]
which stage something has reached, planted at planted, when its stages last lengths seconds each: 1 at first, one more than the number of stages once it's ready (a crop, a building, a cake in the oven)
daytime stage [0, [10, 10, 10], 25]
-- 3
daytime grown [planted, lengths, now]
has it grown through all its stages?
daytime grown [0, [10, 10, 10], 25]
-- false
Touch and sound
pad
The buttons of a handheld as a game reads them: which way the arrows point, and whether a button is in. The buttons are a record like the frame's input held, pressed and released (decision 121): [left : true, one : true]. Read held buttons to walk and pressed ones to step through a menu, so that one press moves one place.
pad way [buttons]
which way the arrows point, as a pair across and down
pad way [left : true, down : true]
-- -1x1
pad way [one : true]
-- 0x0
pad across [buttons]
the arrows across alone: -1, 0 or 1, for a game that only goes left and right
pad across [right : true]
-- 1
pad upward [buttons]
the arrows up and down alone: -1 up, 1 down
pad upward [up : true]
-- -1
pad either [buttons]
is button one or button two in? ("press 1 or 2")
pad either [two : true]
-- true
pad either [left : true]
-- false
pad any-in [buttons]
is any button or arrow in at all?
pad any-in []
-- false
menu
A cursor over a list of choices, a row of cards or a grid of squares: moving it, keeping it in bounds or wrapping it round, scrolling a long list, and spending points along a row of values, as when building a player. Places count from 1. Step it with pad way of the buttons just pressed.
menu wrap [cursor, count, step]
the cursor moved by step, wrapping round from the end to the start
menu wrap [3, 3, 1]
-- 1
menu wrap [1, 3, -1]
-- 3
menu clamp [cursor, count, step]
the cursor moved by step, kept between 1 and count
menu clamp [3, 3, 1]
-- 3
menu clamp [2, 3, -1]
-- 1
menu grid [cursor, columns, count, step]
the cursor in a grid with some columns moved by a pair, staying put where it would leave the grid or pass the last of count
menu grid [2, 4, 10, 0x1]
-- 6
menu grid [8, 4, 10, 0x1]
-- 8
menu grid [4, 4, 10, 1x0]
-- 4
menu top [cursor, shown, count]
the first place to show of a long list, shown at a time, so that the cursor stays in sight near the middle
menu top [7, 4, 10]
-- 5
menu top [2, 4, 10]
-- 1
menu top [10, 4, 10]
-- 7
menu window [items, cursor, shown]
the choices to show of a long list, each with its place
points spent along a row of values: the one at the cursor raised (or lowered, giving points back) by step, kept between low and high, while there are points to spend; gives the values and the points to spare
Boxes on a screen that a finger taps or the arrows move between, so a menu, a shop or a board works by touch and by keys alike. A box is a record with at (its top left) and size, both pairs; places count from 1.
focus hit [boxes, point]
the place of the first box that holds a point, 0 when none does
the place moved by a step of the arrows: across goes to the next box or the one before, round the ends; up and down go to the nearest box above or below, staying put when there is none
Reading fingers and sticks: swipes, taps, long presses and double taps, pinches and twists, flicks, a stick's direction and its dead zone. Points are pairs on screen, across x down (y grows downward).
gesture swipe [from, to, least]
the way a finger swiped from one point to another, "left", "right", "up" or "down", or false when it moved less than least
gesture swipe [100x100, 40x110, 30]
-- left
gesture swipe [100x100, 105x90, 30]
-- false
gesture stick-direction [v, dead]
which of eight ways a stick points, or false inside the dead zone
the speed of a flick, from where a finger was to where it let go, over the seconds between
gesture flick [0x0, 30x-12, 0.1]
-- 300x-120
music
Notes, scales and chords, and keeping time: the frequency of a note for beep, notes by name ("C4", "F#3", "Bb5") or by MIDI number (A4 is 69), scales and chords from a root, transposing, and beats, bars and snapping times to the beat.
music midi [note]
the MIDI number of a note name
music midi "A4"
-- 69
music midi "C#4"
-- 61
music name-of [m]
the name of a MIDI number, with sharps
music name-of 61
-- C#4
music frequency [note]
the frequency of a note, by name or MIDI number, in hertz (for beep)
music frequency "A4"
-- 440
music frequency "C4"
-- 261.6255653006
music frequency 81
-- 880
music scale [root, kind]
the notes of a scale from a root: major, minor, pentatonic, minor-pentatonic, blues or chromatic
music scale ["A3", "minor-pentatonic"]
-- [A3, C4, D4, E4, G4]
music chord [root, kind]
the notes of a chord from a root: major, minor, seventh, major-seventh, minor-seventh, diminished, augmented or sus4
music chord ["G3", "seventh"]
-- [G3, B3, D4, F4]
music transpose [note, steps]
a note moved up (or down) some semitones
music transpose ["E4", 3]
-- G4
music interval [a, b]
how many semitones from one note up to another
music interval ["C4", "G4"]
-- 7
music beat [bpm]
how long one beat lasts at a tempo, in seconds
music beat 120
-- 0.5
music beat-at [bpm, now]
which beat it is now, counting from 1
music beat-at [120, 2.6]
-- 6
music bar-beat [bpm, per-bar, now]
which bar and which beat in it it is now, as bar x beat
music bar-beat [120, 4, 2.6]
-- 2x2
music quantize [time, bpm, division]
a time snapped to the nearest step of a beat cut into division parts
music quantize [1.13, 120, 4]
-- 1.125
music track [line, step]
a line of music written as text turned into notes. Each word is one step of step beats: a note name ("E5"), "-" holding the note before for another step, "." a rest, or another word (a drum, such as "kick") kept as it is; "|" between bars is skipped. Gives [beat, note, beats] for each note, the note as a MIDI number
notes one beat apart as [time, frequency], ready to play with beep
music melody [["A4", "A5"], 120]
-- [[0, 440], [0.5, 880]]
Space
vec
Two-dimensional vectors, written as pairs like 3x4. Pairs already add, take away, multiply and divide. These are the other things a game needs: length, direction, angle, rotation.
vec of [x, y]
a vector from two numbers
vec of [3, 4]
-- 3x4
vec from-angle [angle]
a vector one long, pointing at an angle (in radians)
vec from-angle 0
-- 1x0
vec size [v]
how long a vector is
vec size 3x4
-- 5
vec unit [v]
the same direction, one long
vec unit 3x4
-- 0.6x0.8
vec angle [v]
the angle a vector points at, in radians
vec angle 0x1
-- 1.5707963268
vec rotate [v, turn]
turned round by an angle, in radians
vec rotate [1x0, 1.5707963267948966]
-- 0x1
vec dot [a, b]
how much two vectors point the same way
vec dot [1x0, 0x1]
-- 0
vec distance [a, b]
the distance between two points
vec distance [0x0, 3x4]
-- 5
vec mix [a, b, t]
part of the way from a to b: t of 0 is a, 1 is b
vec mix [0x0, 10x20, 0.5]
-- 5x10
vec limit [v, most]
no longer than most, in the same direction
vec limit [30x40, 5]
-- 3x4
vec reflect [v, n]
bounced off a surface facing the way of n (n one long)
vec reflect [1x-1, 0x1]
-- 1x1
vec perpendicular [v]
turned a quarter to the left
vec perpendicular 1x0
-- 0x1
vec round [v]
a vector with both parts rounded (for a point on screen, or a cell)
vec round 1.4x2.6
-- 1x3
vec toward [from, to, step]
a point moved toward another by at most step, never past it
vec toward [0x0, 10x0, 4]
-- 4x0
vec aim [from, to, speed]
the velocity that heads from one point to another at speed (a shot aimed at a player)
vec aim [0x0, 3x4, 10]
-- 6x8
vec fan [v, n, spread]
n copies of a velocity fanned out across an angle (radians), for a spread of shots
an angle (radians) brought round to between -pi and pi, so two headings can be compared
vec wrap-angle 7
-- 0.7168146928
vec angle-gap [from, to]
the shortest turn from one heading to another, in radians from -pi to pi
vec angle-gap [3, -3]
-- 0.2831853072
vec turn-toward [from, to, step]
a heading turned toward another by at most step, the short way round (a turret tracking, a ship steering)
vec turn-toward [0, 2, 0.5]
-- 0.5
vec turn-toward [3, -3, 0.5]
-- 3.2831853072
shape
The points of shapes, as lists of pairs, ready to draw or test. Nothing here draws: draw a shape's edges with line, as in shape edges (shape polygon [180x240, 50, 6]) each [[a, b] | line [a x, a y, b x, b y, "#fff"]]
shape circle [c, r, n]
n points evenly round a circle at centre c (a pair) with radius r
shape circle [0x0, 10, 4] collect [p | p x round]
-- [10, 0, -10, 0]
shape polygon [c, r, sides]
a regular polygon with n sides, its first corner straight up
shape polygon [0x0, 10, 3] length
-- 3
shape star [c, outer, inner, n]
a star with n points, between radius outer and inner
shape star [0x0, 10, 5, 5] length
-- 10
shape box [corner, size]
the four corners of a box from its top-left corner and its size (both pairs)
shape box [0x0, 4x2]
-- [0x0, 4x0, 4x2, 0x2]
shape edges [points]
the sides of a closed shape: each point with the next, the last with the first, as [a, b]
shape edges [0x0, 1x0, 0x1] length
-- 3
shape move [points, by]
the shape moved by a pair
shape move [[0x0, 1x1], 5x5]
-- [5x5, 6x6]
shape turn [points, c, angle]
the shape turned round centre c by an angle in radians
shape turn [[1x0], 0x0, 3.141592653589793] collect [p | p x round]
-- [-1]
shape grow [points, c, times-bigger]
the shape grown or shrunk round centre c
shape grow [[2x2], 1x1, 3]
-- [4x4]
shape area [points]
the area inside a closed shape
shape area (shape box [0x0, 4x2])
-- 8
shape centre [points]
the middle of the points
shape centre (shape box [0x0, 4x2])
-- 2x1
shape bounds [points]
the smallest box round the points, as [top-left, bottom-right]
shape bounds [3x1, 0x4, 2x2]
-- [0x1, 3x4]
shape holds [points, p]
is point p inside the closed shape?
shape holds [shape box [0x0, 4x2], 1x1]
-- true
segment
Straight lines between two points, a segment written [from, to] with both ends pairs: how long, the middle, the nearest point to something, where two segments cross, which side a point is on. For lasers, walls, line of sight, cutting and ropes.
Curves from points: Bézier curves pulled toward their control points, smooth curves through every point, and paths of straight legs, with how long a path is, where you are a distance along it and which way you face. For enemies on rails, camera moves, roads and drawing. Points are pairs.
spline bezier [points, t]
the point t of the way along a Bézier curve (any number of control points)
spline bezier [[0x0, 5x10, 10x0], 0.5]
-- 5x5
spline through [points, t]
the point t of the way along a smooth curve through every point (Catmull-Rom)
spline through [[0x0, 10x10, 20x0], 0.5]
-- 10x10
vec round (spline through [[0x0, 10x10, 20x0], 0.25])
-- 4x6
spline path-length [points]
how long a path of straight legs is
spline path-length [0x0, 3x4, 3x10]
-- 11
spline at-distance [points, d]
the point d along a path of straight legs (the end, past its length)
Does this touch that? A point is a pair; a box is [at, size] (at its top-left corner) and a circle [at, r] (at its centre). Distilled from the TaskIAP games: 30 of the 319 test what runs into what, and a tap on a button is the same question.
Boards of cells: a list of rows, each a list of cells, and a cell found by a pair, across x down (1x1 is the top left). Read and change cells, find neighbours, regions and the shortest way through; and the moves of board and puzzle games: rows of three, pieces falling into gaps, 2048 slides, straight lines and what can be seen from where. An empty cell is false. Distilled from the TaskIAP games: 96 of the 319 are played on tiles, 53 match or merge them.
grid make [size, value]
a grid of size (across x down) with every cell holding value
grid make [3x2, 0]
-- [[0, 0, 0], [0, 0, 0]]
grid size [g]
how big a grid is, across x down
grid size [[1, 2, 3], [4, 5, 6]]
-- 3x2
grid inside [g, c]
is a cell on the grid?
grid inside [grid make [3x2, 0], 3x3]
-- false
grid at [g, c]
what's in a cell (false off the grid)
grid at [[[1, 2], [3, 4]], 2x1]
-- 2
grid put [g, c, value]
the grid with one cell changed
grid put [grid make [3x2, 0], 2x1, 9]
-- [[0, 9, 0], [0, 0, 0]]
grid beside [g, c]
the four cells beside one (above, right, below, left) that are on the grid
grid beside [grid make [3x3, 0], 1x1]
-- [2x1, 1x2]
grid around [g, c]
the eight cells round one that are on the grid
grid around [grid make [3x3, 0], 2x2] length
-- 8
grid count-around [g, c, value]
how many of the eight cells round one hold value (Life, minesweeper)
the cells within r of one that can be seen from it (fog of war lifting round a player)
grid seen [grid make [5x5, 0], 3x3, 1, 1] length
-- 5
grid next-step [g, from, to, open]
the next cell on the shortest way from one cell to another through cells whose value passes open (the cell itself when it's there, or when there's no way): one step for a chaser
Worlds of cells that all change at once by simple rules: Life and its cousins, caves grown from noise, and the one-row patterns of rule 30 and rule 90. A world is a grid, a list of rows, of true (alive, or rock) and false.
automata step [world, born, stay]
the next turn of a world: an empty cell comes alive when its count of live neighbours is in born, and a live one lives on when its count is in stay (Life is born [3], stay [2, 3]); beyond the edge counts as empty
a cave map of size grown from noise: each cell starts as rock (true) by the chance fill, then each turn a cell is rock when 5 of the 8 round it are rock (4 if it is rock already); beyond the edge counts as rock, and the border stays rock (the caves of a roguelike)
the next row of a one-row world by an elementary rule from 0 to 255: each cell looks at itself and the cells either side (beyond the ends counts as empty); rule 90 draws Sierpinski's triangle, and rule 30 looks random
Levels drawn as text, a character a tile, as platform and maze games build them. Read the tile at a point, find where each kind of tile is, clear the markers once their things are made, and move a body through the map without passing into walls, landing on one-way platforms from above. A map is a list of rows of text; cells are pairs across x down from 1x1; tile is a tile's size in pixels; a body is [at, speed], at being the top left of a box.
tilemap char-at [map, p, tile]
the character at a pixel point, a space off the map
a body moved for dt seconds through the map without passing into tiles whose characters are in solids, landing on those in platforms only from above. Gives the body with ground (standing on something), wall (1 or -1 when it hit one going right or left, else 0) and ceiling
A well of cells for falling-block and matching games, kept as rows of text, one letter a cell and "." for an empty one: ["..r.", "rrgg"]. Find the runs of one letter long enough to pop, empty them, and let what is loose fall, while the letters named as fixed stay where they are. Places are pairs, across then down, counting from 1x1 at the top left.
runs cell-at [rows, place]
the cell at a place, "." past the edges
runs cell-at [["ab", "cd"], 2x1]
-- b
runs cell-at [["ab", "cd"], 3x1]
-- .
runs put [rows, place, cell]
the rows with one cell put at a place
runs put [["ab", "cd"], 1x2, "x"]
-- [ab, xd]
runs open [rows, places]
are all these places inside the rows and empty? (can a piece go there)
runs open [["..", "r."], [1x1, 2x2]]
-- true
runs open [["..", "r."], [1x2]]
-- false
runs open [["..", "r."], [0x1]]
-- false
runs find [rows, least]
the places in runs of at least least cells of the same letter, across or down, each place once, row by row
one column of cells, top to bottom, with every loose cell dropped onto whatever holds it up: the bottom, another cell, or a fixed letter, which stays where it is
the rows with every loose cell fallen as far as it goes; the letters in fixed stay put
runs fall [["a.", "..", ".b"], ""]
-- [.., .., ab]
runs fall [["a.", "R.", ".."], "R"]
-- [a., R., ..]
runs fall [[".a", "b.", "R.", ".."], "R"]
-- [.., b., R., .a]
runs count [rows, letters]
how many cells in the rows are one of these letters
runs count [["R.r", "G.."], "RGB"]
-- 2
piece
The pieces of a block puzzle and the board they go on. A board is a grid (rows of values, 0 for an empty square); a piece is its cells, pairs counted from 0x0 at its top left, written as rows of text with # for a cell. See where a piece fits, put it on, find the rows and columns that are full and clear them. Places on the board count from 1, as in grid.
piece cells [lines]
a piece's cells from rows of text, # for a cell and anything else for none
piece cells ["##", "#."]
-- [0x0, 1x0, 0x1]
piece size [bits]
how many columns across and rows down a piece takes
piece size [0x0, 1x0, 0x1]
-- 2x2
piece fits [board, bits, at]
does the piece go on the board with its top left at a place: all inside, all on empty squares?
the piece turned a quarter round clockwise, still counted from 0x0
piece turn [0x0, 1x0, 2x0]
-- [0x0, 0x1, 0x2]
piece turn [0x0, 0x1, 1x1]
-- [1x0, 0x0, 0x1]
piece filled [board]
how many squares of the board are filled
piece filled [[1, 0], [0, 3]]
-- 2
hex
Grids of hexagons, the board of strategy games. A hex is a pair q x r in axial coordinates (the third, s, is 0 - q - r), pointed upward. Distilled from the TaskIAP games: 23 of the 319 play on hexes.
hex around [h]
the six hexes round one
hex around 0x0
-- [1x0, 1x-1, 0x-1, -1x0, -1x1, 0x1]
hex steps [a, b]
how many steps from one hex to another
hex steps [0x0, pair [2, -1]]
-- 2
hex within [h, n]
every hex within n steps of one
hex within [0x0, 2] length
-- 19
hex to-screen [h, size]
where a hex's centre is on screen, for hexes size from centre to corner
vec round (hex to-screen [1x1, 10])
-- 26x15
hex snap [h]
the nearest whole hex to fractional axial coordinates
hex snap 0.6x0.7
-- 0x1
hex from-screen [p, size]
the hex under a point on screen (a tap), for hexes size from centre to corner
hex from-screen [26x15, 10]
-- 1x1
iso
Isometric views, the diamond tiles of city builders and tactics games. A cell is a pair, across x down the map; a tile is the size of its diamond on screen, such as 64x32. Turn cells into screen points and back, draw in the right order and find a tile's corners.
iso to-screen [cell, tile]
the middle of a cell's tile on screen
iso to-screen [2x1, 64x32]
-- 32x48
iso from-screen [p, tile]
the cell under a point on screen
iso from-screen [32x48, 64x32]
-- 2x1
iso from-screen [40x52, 64x32]
-- 2x1
iso depth [cell]
how far back a cell is: draw smaller first
iso depth 2x1
-- 3
iso order [cells]
cells in the order to draw them, back to front
iso order [3x3, 1x1, 2x1]
-- [1x1, 2x1, 3x3]
iso diamond [cell, tile]
the four corners of a cell's tile on screen: top, right, bottom, left
iso diamond [0x0, 64x32]
-- [0x-16, 32x0, 0x16, -32x0]
iso raised [cell, tile, height]
a point raised above a cell's tile by height pixels, for walls, trees and stacked blocks
iso raised [2x1, 64x32, 10]
-- 32x38
camera
A view that follows. A camera is the point in the world at the middle of the screen, a pair: it glides after its target with a dead zone, stays inside the world, and turns points between the world and the screen. Distilled from the TaskIAP games: 32 of the 319 have a camera that moves.
camera follow [cam, target, share, dead, dt]
the camera's next place, following target: still while the target is within dead of it, else closing share of the gap beyond that every second
the camera moved so a screen of size stays inside a world of size
camera keep-in [pair [5, 300], 100x80, 400x320]
-- 50x280
camera on-screen [cam, p, screen]
where a world point lands on a screen of size
camera on-screen [100x100, 130x90, 320x240]
-- 190x110
camera to-world [cam, p, screen]
the world point under a point on the screen (where a tap landed)
camera to-world [100x100, 190x110, 320x240]
-- 130x90
parallax
Layers that scroll at their own speeds, as far things go by slowly and near things fast: where a layer is for a camera, the copies of a repeating layer that cover the screen, where a thing in the world shows, and whether it shows at all. A depth of 1 moves with the world, 0.5 at half its speed, 0 not at all.
parallax offset [camera, depth]
how far a layer at depth has moved when the camera has moved so far
parallax offset [200, 0.5]
-- 100
parallax to-screen [world-x, camera, depth]
where a thing in the world shows on the screen, on a layer at depth
which piece of a stretch laid out in pieces so wide a place in the world falls in, counting from 1
parallax piece-at [70, 32]
-- 3
parallax letter-at [plan, world-x, size]
the letter of a plan (a stretch written a letter a piece, like "..h.._..") under a place in the world, or "." past its end
parallax letter-at ["..h_", 70, 32]
-- h
parallax letter-at ["..h_", 500, 32]
-- .
orbit
Things going round: the point on a circle at a turn, the turn a point is at, which way is out and which way is along, whether a point is on a ring, the short way between two turns and how far apart they are, and where a turning thing has got to. Turns run from 0 to 1 the way a clock's hand goes on a screen, y down: 0 is right, a quarter is down. For orbit hoppers, clocks, radial menus, planets and anything on a wheel.
orbit point [centre, radius, turn]
the point on a circle round a centre at a turn
orbit point [100x100, 50, 0.25]
-- 100x150
orbit turn-of [centre, p]
the turn a point is at round a centre, from 0 up to 1
orbit turn-of [100x100, 100x150]
-- 0.25
orbit turn-of [0x0, -1x0]
-- 0.5
orbit outward [centre, p]
the unit pair pointing out from the centre through a point
orbit outward [0x0, 0x10]
-- 0x1
orbit along [turn, spin]
the unit pair along a circle at a turn, going round the way spin goes (1 the clock's way, -1 the other)
orbit along [0, 1]
-- 0x1
orbit near [p, centre, radius, slack]
is a point on a ring, within slack of it?
orbit near [0x48, 0x0, 50, 4]
-- true
orbit near [0x40, 0x0, 50, 4]
-- false
orbit gap [from, to]
the short way from one turn to another, between -0.5 and 0.5
orbit gap [0.9, 0.1]
-- 0.2
orbit gap [0.1, 0.9]
-- -0.2
orbit apart [from, to, radius]
how far apart two turns are round a ring of a radius, the short way, as a distance
orbit apart [0, 0.25, 4]
-- 6.2831853072
orbit spun [turn, spin, seconds]
where a thing going round has got to after some seconds at spin turns a second, from 0 up to 1
orbit spun [0.75, 0.5, 1]
-- 0.25
orbit spun [0.1, -0.5, 1]
-- 0.6
layout
Placing boxes on a screen, for menus, cards, buttons and HUDs. A box is [at, size], where at is its top left corner and size its width x height, both pairs, as in collide. Cut a box into columns, rows, a grid or shares, inset it, centre or pin something inside it, fit a picture in it, letterbox a game in a window and find which box a tap fell in.
Grids of numbers kept as lists of rows: multiplying, turning over, determinants, inverses and solving equations; and moves, turns and scales in 2D as 3x3 matrices that chain together and carry points.
moves, turns and scales chained into one, the first done first
matrix point [matrix then [matrix scale 2x2, matrix move 10x0], 1x1]
-- 12x2
matrix point [m, p]
a point carried by a 2D matrix
matrix point [matrix then [matrix turn (pi / 2), matrix move 5x0], 2x0]
-- 5x2
geo
Places on Earth, each a pair of latitude x longitude in degrees (south and west negative): how far apart, which way, where you end up, halfway, the nearest place, and a flat map in kilometres around a point. Distances are in km on a round Earth, close enough for maps and games.
Random choices you can repeat. Each one takes a seed (any number): the same seed always gives the same answer, on every machine, and a game that rewinds gets the same luck back. Use a different seed for each choice, such as the frame number, or a thing's number times 10 plus which choice it is.
seeded number [seed]
a number from 0 up to 1
seeded number 42
-- 0.0565482103
seeded between [low, high, seed]
a number from low up to high
seeded between [10, 20, 42]
-- 10.5654821033
seeded whole [low, high, seed]
a whole number from low to high, both included
seeded whole [1, 6, 42]
-- 1
seeded chance [p, seed]
true with chance p (from 0 to 1)
seeded chance [0.5, 42]
-- false
seeded pick [items, seed]
one item of a list
seeded pick [["rock", "paper", "scissors"], 42]
-- rock
a number from a bell curve: usually near mean, spread out by spread
seeded bell [100, 15, 42] round
-- 99
seeded in-circle [r, seed]
a point inside a circle of radius r round 0x0, spread evenly
seeded in-circle [10, 42] x round
-- -2
seeded weighted [items, weights, seed]
n choices from a list, by their weights: [items, weights, seed]
seeded weighted [["common", "rare"], [9, 1], 42]
-- common
seeded triangle [low, likely, high, seed]
a number from low to high, most often near likely: a three-point guess at how long a task will take
seeded triangle [2, 3, 8, 42]
-- 6.3817927252
seeded triangle [5, 5, 5, 42]
-- 5
dice
Rolls you can repeat with a seed, written the way tabletop games write them (2d6+3), and the odds of every total. Distilled from the TaskIAP games: 66 of the 319 roll dice.
dice rolls [n, sides, seed]
the faces of n dice with sides sides
dice rolls [3, 6, 7]
-- [1, 5, 5]
dice roll [notation, seed]
the total of a roll written as 2d6+3, d20 or 3d8-1
dice roll ["2d6+3", 7]
-- 9
dice odds [n, sides]
the chance of each total with n dice of sides sides, as [total, chance]
dice odds [2, 6] @ 6
-- [7, 0.1666666667]
dice at-least [n, sides, target]
the chance of rolling target or more with n dice of sides sides
dice at-least [2, 6, 10]
-- 0.1666666667
dice advantage [seed]
a d20 rolled with advantage: two rolled, the higher kept
dice advantage 7
-- 17
cards
A deck of playing cards, shuffled with a seed, dealt and scored. A card is [rank : 1 to 13, suit : "♠"], an ace being 1 and a king 13. Distilled from the TaskIAP games: 96 of the 319 deal cards of some kind.
cards suits
the four suits
cards suits
-- [♠, ♥, ♦, ♣]
cards deck
the 52 cards, in order
cards deck length
-- 52
cards shuffled [seed]
the 52 cards in an order set by seed (the same seed, the same order)
The cards of a deckbuilder: the stock (the pile you draw from), a hand and a discard pile, kept as [stock, hand, discard]. Draw cards (the discard pile is shuffled back into the stock by seed when it runs out), play them, and put the hand away at the end of a turn. Any values can be cards.
piles fresh [deck, seed]
a deck shuffled into the stock, with an empty hand and discard pile
A slot machine's grid and what it pays. A grid is a list of rows, each a list of symbols; a place is a pair, the column across and the row down, from 1x1. Symbols are drawn by their weights from a seed, so a run that rewinds gets the same luck. The paylines are the rows, the columns and the diagonals; a win is a line whose first symbols are alike, at least so many of them, and a table of pays gives what each is worth.
reels spin [symbols, weights, size, seed]
a grid of symbols, size across and down, each drawn by its weight from the seed
reels spin [["a", "b"], [1, 0], 3x2, 7]
-- [[a, a, a], [a, a, a]]
the paylines of a grid of a size: each row, each column, and every diagonal as long as the grid is tall, falling to the right and rising to the right; each line is its kind and its places, in order from where it starts
the wins on some lines: each line whose first symbols are alike, at least length of them, with its kind, the symbol, how many are alike and their places
how many reels have stopped, count of them stopping one after another gap seconds apart from a spin that began then
reels stopped [10, 5, 0.25, 10.9]
-- 3
reels stopped [10, 5, 0.25, 10.1]
-- 0
reels stopped [10, 5, 0.25, 20]
-- 5
reels blur [symbols, column, row, now]
the symbol a still-rolling reel shows at a row, flicking past quickly
reels blur [["a", "b", "c"], 2, 1, 0.5]
-- a
bag
The symbols a player owns in a slot game whose reels they build. A bag is a list of symbol names; a pull draws a grid from it by seed, each symbol as likely as its share of the bag. Symbols are added, scrapped and gilded; a gilded symbol is its name with "+" after it ("pearl+") and still counts as its kind.
bag kind [symbol]
a symbol's kind, gilded or not
bag kind "pearl+"
-- pearl
bag kind "fish"
-- fish
bag gilded [symbol]
is a symbol gilded?
bag gilded "pearl+"
-- true
bag draw [owned, size, seed]
a grid of symbols, size across and down, each drawn from the bag by the seed
bag draw [["a"], 3x2, 7]
-- [[a, a, a], [a, a, a]]
bag draw [["a", "b", "c"], 4x2, 9] collect [r | r length]
-- [4, 4]
bag add [owned, symbol]
the bag with a symbol added
bag add [["a"], "b"]
-- [a, b]
bag scrap [owned, name]
the bag with one symbol of a kind taken out, a plain one before a gilded one
bag scrap [["a", "b", "a+"], "a"]
-- [b, a+]
bag scrap [["b", "a+"], "a"]
-- [b]
bag scrap [["b"], "a"]
-- [b]
bag gild [owned, name]
the bag with one plain symbol of a kind gilded
bag gild [["a", "b", "a"], "a"]
-- [a+, b, a]
bag gild [["a+"], "a"]
-- [a+]
bag counts [owned]
how many of each kind the bag holds, gilded ones with their kind
bag counts ["a", "b", "a+"]
-- [a : 2, b : 1]
bag odds [owned, name]
the share of the bag that is a kind, from 0 to 1
bag odds [["a", "b", "a+", "c"], "a"]
-- 0.5
bag odds [[], "a"]
-- 0
bag gilt-count [owned, name]
how many of a kind are gilded
bag gilt-count [["a+", "a", "a+"], "a"]
-- 2
shop
The shop between the rounds of a roguelike. Offers are drawn from a pool by rarity with a seed, none twice; prices grow with depth, rerolls cost more each time, things sell back for half, and coins held earn interest. An offer is a record with a rarity: "common", "uncommon", "rare" or "legendary".
shop weight [rarity]
how often a rarity comes up against the others
shop weight "rare"
-- 10
shop weight "junk"
-- 0
shop draw [pool, seed]
one offer from a pool, drawn by its rarity's weight from the seed
shop draw [[[name : "a", rarity : "legendary"]], 4] name
-- a
shop offers [pool, many, seed]
some offers from a pool, none twice, each drawn by its rarity's weight from the seed
a price grown with depth: the base cost and a share more for each level down, rounded
shop price [10, 5, 0.1]
-- 15
shop reroll [base, rolls, step]
what the next reroll costs: the base, and step more for each reroll already bought
shop reroll [3, 2, 2]
-- 7
shop sell [cost]
what a thing bought for a price sells back for: half, rounded down
shop sell 25
-- 12
shop interest [coins, per, cap]
interest on coins held: one for each so many, up to a cap
shop interest [47, 10, 5]
-- 4
shop interest [470, 10, 5]
-- 5
shop rarer [a, b]
the rarer of two rarities
shop rarer ["common", "rare"]
-- rare
Play
combat
The numbers of a fight: damage through armour, critical hits, health, experience and levels, cooldowns and damage over time. Distilled from the TaskIAP games: 57 of the 319 count hit points, 33 roll critical hits.
combat damage [attack, armour]
damage after armour: each point takes a share off and none takes it all (100 armour halves it)
combat damage [40, 100]
-- 20
combat strike [amount, odds, times, seed]
a hit that may be critical: [amount, crit], critical with chance (0 to 1) and then times as hard
Rounds of enemies that grow harder: how many come, how tough they are, how quickly, where from, and when the boss comes. Distilled from the TaskIAP games: 33 of the 319 spawn enemies, 27 in waves, 25 with a boss.
waves size [n, first, growth]
how many come in wave n: first in wave 1, and growth times as many each wave after
waves size [5, 4, 1.3]
-- 11
waves toughness [n]
how tough each one is in wave n, as a share of the first wave's (it climbs gently)
waves toughness 10
-- 2.08
waves gap [n, slowest, fastest]
the seconds between arrivals in wave n: quicker each wave, never quicker than fastest
waves gap [20, 2, 0.4]
-- 0.4
waves boss [n, every]
is wave n a boss wave (every every-th one)?
waves boss [10, 5]
-- true
waves spawn-point [k, total, centre, radius, seed]
where the k-th of total arrives: spaced evenly round a ring of radius about centre, the ring turned by seed
Sparks, dust and confetti as records [at, speed, born, life, colour] (at and speed are pairs), burst from a point with a seed (so a replay bursts the same), moved a step at a time, faded and gone. Distilled from the TaskIAP games: 29 of the 319 throw confetti, 18 more spray particles.
particles burst [from, n, speed, life, colours, now, seed]
n particles bursting from a point at up to speed, living life seconds, coloured from colours, from now
how much of a particle is left at now, from 1 (new) to 0 (gone): for its size, or how see-through it is
particles fade [[born : 1, life : 2], 2]
-- 0.5
rewards
What brings players back: streaks, stars, grades, best scores, achievements, and saved progress kept up to date. Distilled from the TaskIAP games: 118 of the 319 save progress, 42 count streaks, 25 award achievements.
rewards streak-points [base, streak]
points for a right answer on a streak: each one in a row adds a tenth more, up to double
rewards streak-points [100, 4]
-- 130
rewards day-streak [streak, last-day, today]
a daily streak brought up to today (days are numbers): kept on the same day, one more the next day, back to 1 after a gap
rewards day-streak [6, 41, 42]
-- 7
rewards stars [score, marks]
stars for a score: one for each mark it reaches
rewards stars [720, [300, 600, 900]]
-- 2
rewards grade [share]
a letter grade for a share right (0 to 1)
rewards grade 0.83
-- B
rewards top [scores, score, n]
a best-scores table with a new score in its place, kept to the top n
saved progress brought up to date: every field the defaults have, with the saved value where there is one (and whatever the defaults no longer have, left behind)
Branching scenes and talk. A story is a record of scenes; a scene is [text, choices], and a choice is [label, to], or [label, to, needs] when it needs a flag set first. Flags are a list of names. Distilled from the TaskIAP story and dating games: 31 of the 319 offer choices.
story open [tale, scene, flags]
the choices open in a scene, given the flags set
story open [[start : [text : "A door.", choices : [["Open it", "hall"], ["Pick the lock", "vault", "lockpick"]]]], "start", []] length
-- 1
story go [choices, k]
the scene a choice leads to
story go [[["Open it", "hall"]], 1]
-- hall
story flag [flags, name]
flags with name set (once)
story flag [["met-guard"], "has-key"]
-- [met-guard, has-key]
story typed [text, per-second, elapsed]
text typing itself out at per-second letters a second: what shows after elapsed seconds
story typed ["Hello there", 10, 0.5]
-- Hello
story typed-all [text, per-second, elapsed]
has all the text typed out yet?
story typed-all ["Hello", 10, 0.4]
-- false
wordplay
Guessing games and letters: the marks a guess earns, anagrams, scrambles and hidden words. Distilled from the TaskIAP word games (DECAWORDLE among them): 25 of the 319 have you guess words.
wordplay marks [guess, answer]
the marks a guess earns against the answer, letter by letter: G in the right place, Y in the word but elsewhere, - not in it. Letters are counted, so two Es guessed against one E mark only one of them
wordplay marks ["SPEED", "ABIDE"]
-- --Y-Y
wordplay anagram [a, b]
are two words made of the same letters?
wordplay anagram ["listen", "silent"]
-- true
wordplay scramble [word, seed]
a word with its letters mixed up by seed (and not left as it was, if another try can help it)
wordplay scramble ["planet", 7]
-- lnaetp
wordplay hide [word, guessed]
a word with the letters not yet guessed hidden
wordplay hide ["planet", "aep"]
-- p_a_e_
wordplay solved [word, guessed]
has every letter of the word been guessed?
wordplay solved ["planet", "planetx"]
-- true
wordplay vowels [word]
how many vowels a word has
wordplay vowels "sprout"
-- 2
league
Seasons of games between teams: who plays whom, the table, ratings and the chance of winning. Distilled from the TaskIAP games: 48 of the 319 run a league or a schedule, 24 rate their players.
league rounds [teams]
every team meets every other once, in rounds where each plays once (the circle method); with an odd number, one rests
The arithmetic of shops, tycoons and incremental games: prices that climb, how many you can afford, earnings while away, wandering markets, and starting over for a bonus. Distilled from the TaskIAP games: 45 of the 319 earn while you wait, 41 have prices and markets, 35 a shop of upgrades.
economy price [base, growth, owned]
the price of the next one when owned are owned already and each costs growth times the one before (1.15 is usual)
what was earned while away: per-second for the seconds gone, but no more than cap-hours of it
economy away [2.5, 1, 7200]
-- 9000
economy prestige [lifetime]
the bonus for starting over, from everything ever earned: a square root, so each one comes slower
economy prestige 4000000
-- 2
economy wander [now-price, fair, swing, seed]
a market price's next step: wandering by up to swing (0.1 is 10%) and pulled gently back toward fair
economy wander [100, 100, 0.1, 7] round
-- 108
needs
What a pet, a plant or a person in a care game needs, as levels from 0 to 100 that fade as time goes by and are filled by looking after them. The levels are a record ([food : 80, water : 60]); the rates say how much each one drops a second. For virtual pets, farm animals, gardens and survival games.
needs fade [levels, rates, dt]
each level dropped by its rate for dt seconds, kept between 0 and 100 (a level with no rate keeps still)
needs fade [[food : 80, water : 60], [food : 2, water : 4], 5]
-- [food : 70, water : 40]
needs fade [[food : 3, water : 60], [food : 2], 5]
-- [food : 0, water : 60]
needs fill [levels, name, amount]
one level filled by an amount (or emptied by a negative one), kept between 0 and 100
needs fill [[food : 80, water : 60], "food", 30]
-- [food : 100, water : 60]
needs fill [[food : 80, water : 60], "water", -25]
-- [food : 80, water : 35]
needs lowest [levels]
the most urgent need: the name of the lowest level
needs lowest [food : 80, water : 60, clean : 70]
-- water
needs under [levels, line]
the names of the levels under a line, lowest first, to warn about
needs under [[food : 80, water : 20, clean : 35], 40]
-- [water, clean]
needs care [levels]
how well looked after, all told: the average of the levels, rounded
needs care [food : 90, water : 60, clean : 71]
-- 74
needs mood [levels]
a word for how it feels: HAPPY, OK or SAD from the average, or what it needs most when one level is very low
needs mood [food : 90, water : 80]
-- HAPPY
needs mood [food : 50, water : 45]
-- OK
needs mood [food : 90, water : 10]
-- WATER?
Colour
palette
Colours made from hue, saturation and lightness, colours mixed along a line, and a few sets that go together.
palette hsl [hue, sat, light]
a colour from hue (0 to 360), saturation and lightness (0 to 1)
palette hsl [30, 0.8, 0.55]
-- #e88c30
palette along [stops, t]
a colour part of the way along a list of colours: t of 0 is the first, 1 the last
palette along [[#000000, #ff0000, #ffffff], 0.75]
-- #ff8080
Modules that draw. A kit is written in Sprout like the modules above, but it draws with the game's own drawing words, so it comes along with a game that names it: ui banner ["GO", 40, 8, #ffffff]. Each example shows what it draws on a SPROUT·8 screen, 256 pixels across and 192 down, and that is checked each time the library is built too.
The look of a 1990 sunset: a sky in stacked bands, a sun cut by stripes, palm trees, a sea of moving waves, a grid floor running off to the horizon and neon signs. A kit (decision 122): it draws with the game's own words, so it comes along when a game names it. Pair it with parallax for layers that scroll at their own speeds.
retro bands [top, height, colours]
a sky in stacked bands of colour, top to bottom, from top down height pixels, across the whole screen
retro bands [0, 30, [#000055, #550055, #aa0055]]
-- draws rect [0, 0, 256, 10, #000055], rect [0, 10, 256, 10, #550055], rect [0, 20, 256, 10, #aa0055]
retro sun [at, size, colour, stripes, back]
a sun cut across its lower half by stripes of the sky behind it, each one wider than the one above
retro sun [100x50, 8, #ffff55, 2, #aa0055]
-- draws circle [100, 50, 8, #ffff55], rect [92, 52, 16, 1, #aa0055], rect [92, 55, 16, 2, #aa0055]
retro palm [at, size, trunk, leaves]
a palm tree standing on at, size pixels high: a trunk leaning as it rises and five fronds drooping from the top
retro palm [20x100, 16, #550000, #005500]
-- draws rect [20, 96, 3, 5, #550000], rect [21, 92, 3, 5, #550000], rect [22, 88, 3, 5, #550000], rect [23, 84, 3, 5, #550000], line [25, 84, 15, 88, #005500], line [25, 85, 15, 89, #005500], line [25, 84, 17, 82, #005500], line [25, 85, 17, 83, #005500], line [25, 84, 26, 80, #005500], line [25, 85, 26, 81, #005500], line [25, 84, 33, 83, #005500], line [25, 85, 33, 84, #005500], line [25, 84, 34, 88, #005500], line [25, 85, 34, 89, #005500]
retro sea [top, height, deep, foam, speed, now]
a sea between top and top + height with lines of foam drifting along it, so many pixels a second, now
retro sea [100, 8, #0055aa, #55ffff, 10, 0]
-- draws rect [0, 100, 256, 8, #0055aa], rect [37, 102, 6, 1, #55ffff], rect [101, 102, 6, 1, #55ffff], rect [165, 102, 6, 1, #55ffff], rect [229, 102, 6, 1, #55ffff], rect [10, 106, 6, 1, #55ffff], rect [74, 106, 6, 1, #55ffff], rect [138, 106, 6, 1, #55ffff], rect [202, 106, 6, 1, #55ffff]
retro grid-floor [top, back, lines, rows, now]
a grid floor from top to the bottom of the screen, lines rushing toward you as the floor moves along, now
retro grid-floor [180, #000055, #ff55aa, 3, 0]
-- draws rect [0, 180, 256, 12, #000055], line [0, 180, 255, 180, #ff55aa], line [0, 181, 255, 181, #ff55aa], line [0, 185, 255, 185, #ff55aa], line [128, 180, -128, 192, #ff55aa], line [128, 180, 0, 192, #ff55aa], line [128, 180, 128, 192, #ff55aa], line [128, 180, 256, 192, #ff55aa], line [128, 180, 384, 192, #ff55aa]
retro neon [word, at, glow, frame, now]
a neon sign: a word lit in one colour inside a frame of another, flickering off now and then
retro neon ["OPEN", 40x30, #ff55aa, #55ffff, 0]
-- draws rect [20, 22, 40, 16, #55ffff], rect [21, 23, 38, 14, #000000], text [OPEN, 40, 30, 8, #ff55aa]
ui
The drawing a game does again and again: titles with a shadow, prompts that blink, boxes, meters, menus, a strip of words along the top, talk typed out a letter at a time, words that rise from where something happened, and wipes between scenes. A kit (decision 122): it draws with the game's own drawing words, so it comes along when a game names it. The middle of the screen is W / 2, whatever the screen.
ui banner [line, y, size, colour]
a line of words across the middle with a shadow one pixel down and right
ui banner ["GO", 40, 8, #ffffff]
-- draws text [GO, 129, 41, 8, #000000], text [GO, 128, 40, 8, #ffffff]
ui blink [line, y, colour, now]
a prompt across the middle that shows for half of every second, as on a title screen
ui blink ["PRESS 1", 180, #ffffff, 0.25]
-- draws text [PRESS 1, 128, 180, 8, #ffffff]
ui blink ["PRESS 1", 180, #ffffff, 0.75]
-- draws nothing
ui panel [at, size, edge, fill]
a box: an edge two pixels wide and a fill inside it
ui panel [10x20, 40x30, #ffffff, #000000]
-- draws rect [10, 20, 40, 30, #ffffff], rect [12, 22, 36, 26, #000000]
ui meter [at, size, amount, most, fill, back]
a bar filled as far as amount goes toward most, for life, time left or a shot's power
ui meter [10x10, 40x4, 3, 4, #ff0000, #555555]
-- draws rect [10, 10, 40, 4, #555555], rect [10, 10, 30, 4, #ff0000]
ui choices [items, picked, at, lit, dim]
a list of choices down the screen from at, twelve pixels apart, the chosen one lit and pointed at
ui choices [["PLAY", "QUIT"], 1, 100x80, #ffff55, #aaaaaa]
-- draws text [>, 92, 80, 8, #ffff55], text [PLAY, 100, 80, 8, #ffff55, left], text [QUIT, 100, 92, 8, #aaaaaa, left]
a strip along the top of the screen, with words at the left, in the middle and at the right
ui strip ["HP 9", "FLOOR 2", "BEST 4", #000000, #ffffff]
-- draws rect [0, 0, 256, 12, #ffffff], text [HP 9, 4, 6, 8, #000000, left], text [FLOOR 2, 128, 6, 8, #000000], text [BEST 4, 252, 6, 8, #000000, right]
ui talk [line, began, now]
a line of talk in a box along the bottom, typed out at 24 letters a second from when it began, three rows at most
ui talk ["HELLO THERE", 0, 0.1]
-- draws rect [4, 144, 248, 44, #ffffff], rect [6, 146, 244, 40, #000000], text [HE, 12, 154, 8, #ffffff, left]
ui talked [line, began, now]
has a line of talk that began then finished typing?
ui talked ["HELLO", 0, 1]
-- true
ui float [line, at, colour, began, now]
words that rise from where something happened for a second, like +2 over a basket
ui float ["+2", 100x80, #ffff55, 1, 1.5]
-- draws text [+2, 100, 70, 8, #ffff55]
ui wipe [amount, colour]
a wipe between scenes: bars close in from both sides as amount goes from 0 to 1, and open again from 1 to 2
ui wipe [0.5, #000000]
-- draws rect [0, 0, 64, 192, #000000], rect [192, 0, 64, 192, #000000]
Wrapped libraries
Popular JavaScript libraries, each a module like the ones above. A library is loaded only when a program names it, from this site, so nothing is fetched unless it is used.
English, understood a little: the nouns, verbs, people and places in text, plurals, tenses and numbers written as words.
nlp nouns
the nouns in some text
nlp nouns "The quick fox jumps over the lazy dogs"
-- [The quick fox, over the lazy dogs]
nlp verbs
the verbs in some text
nlp verbs "She sells shells and he sang"
-- [sells, sang]
nlp people
the people named in some text
nlp people "Ada Lovelace wrote to Charles Babbage"
-- [Ada Lovelace, Charles Babbage]
nlp places
the places named in some text
nlp places "From Paris to New York by way of Iceland"
-- [Paris, New York, Iceland]
nlp sentences
text split into sentences
nlp sentences "It rained. Then it stopped! Did it?"
-- [It rained., Then it stopped!, Did it?]
nlp plural
a noun made plural
nlp plural "goose"
-- geese
nlp singular
a noun made singular
nlp singular "mice"
-- mouse
nlp past
text put in the past tense
nlp past "she walks to the shop"
-- she walked to the shop
nlp future
text put in the future tense
nlp future "she walks to the shop"
-- she will walk to the shop
nlp numbers
the numbers in some text, even written as words
nlp numbers "five apples and twenty-two pears"
-- [5, 22]
tone · Tone.js, MIT licence · in the browser only
Music in the browser: notes, chords and drums. These are effects, like beep: in update they happen after the frame, and never again on rewind.
tone play
a note for a time, both as text: [note, length]. Lengths are like 8n (an eighth) or 0.5 (seconds)
tone chord
several notes at once: [notes, length]
tone drum
a drum: kick, snare or hat
tone frequency
a note's frequency in hertz
zzfx · ZzFX, MIT licence · in the browser only
Tiny 8-bit sound effects made on the spot from a list of numbers (the Zuper Zmall Zound Zynth, by Frank Force), with ready-made ones for games. These are effects, like beep: in update they happen after the frame, and never again on rewind.
zzfx play
a sound from ZzFX's own numbers: [volume, randomness, frequency, attack, sustain, release, shape, ...]
zzfx preset
a ready-made sound by name: coin, jump, hit, hurt, explode, power, laser, blip, select or step; or [name, pitch] to play it higher (2) or lower (0.5)
zzfx names
the names of the ready-made sounds
turf · Turf, MIT licence
Geography on a round Earth: distances, bearings, areas and points along a route. A point is [longitude, latitude]; a line or a polygon is a list of points.