Skip to content

Instantly share code, notes, and snippets.

LIST Fruit = Apple, Banana, Orange, Lemon
VAR fruitSaladIndex = 0
- (top)
* [add apple ]
~ addToSalad(Apple)
* [ add banana ]
~ addToSalad(Banana)
* [ add orange ]
~ addToSalad(Orange)
@joningold
joningold / intToListItem.ink
Created May 27, 2022 08:49
Assigning Values to List Items
LIST Entrants = PabloPicasso, VanGogh, LucyPhillipsAged11
~ temp place = 3
- (loop)
{ stopping:
- "Third place in the art competition goes to..."
- "Second place goes to..."
- "And so the winner is..."
@joningold
joningold / swindlestones.ink
Last active February 21, 2022 22:31
Swindlestones: a game of liar's dice from the city of Kharé
#story: Swindlestones
#author: Jon Ingold
// Play this example online: https://7zjr87zk.play.borogove.io/
LIST Dice =
MeA1 = 11, MeA2, MeA3, MeA4,
MeB1 = 21, MeB2, MeB3, MeB4,
MeC1 = 31, MeC2, MeC3, MeC4,
MeD1 = 41, MeD2, MeD3, MeD4,
EXTERNAL tunnelDepth()
=== function tunnelDepth()
// Tunnel Depth not supported in inky!
~ return 1
=== tunnelOut(-> thenGoTo)
{ tunnelDepth() > 1:
// Tunnelling out!
->-> tunnelOut(thenGoTo)
}
@joningold
joningold / quickRelations.ink
Last active December 5, 2023 08:31
Quick way to create, query and remove relations between list items
~ relate(Key, MadeOf, Copper)
~ relate((Padlock, Spear), MadeOf, Iron)
~ relate(GoldCoin, MadeOf, Gold)
VAR Inventory = ()
- (top)
@joningold
joningold / printingByIndex.ink
Last active July 11, 2021 01:37
A quick system for printing from a list by index in ink
~ temp charA = RANDOM(1, 10000)
~ temp charB = RANDOM(1, 10000)
{characterName(charA)} and {characterName(charB)} walk into a bar. {characterName(charA)} is feeling {~ worried|happy}.
=== function characterName(nameSeed)
{firstNameByIndex(nameSeed / 100)} {secondNameByIndex(nameSeed % 100)}
@joningold
joningold / quiz.ink
Created September 25, 2018 18:38
Shuffled choices example
LIST PossibleFruits = Apple, Banana, Satsuma, Melon, Pear
- (anotherquiz)
One fruit in the fruit-bowl is fake. Can you guess which one?
~ temp correctAnswer = LIST_RANDOM(LIST_ALL(PossibleFruits))
- (anothergo)
~ temp timesLooped = 0
@joningold
joningold / date.ink
Last active June 15, 2021 18:45
Using a list of adjectives to describe a number
Include list_descriptions.ink
LIST QualityAdjectives = awful = -3, bad = -1, ambivalent = 0, nice = 1, great = 3, amazing = 7
LIST InterpersonalAdjectives = excruciating = -3, dull = -1, fine = 0, interesting = 1, intriguing = 3, charming = 7
- (swipeRight)
~ temp food = RANDOM(-5, 4)
~ temp company = RANDOM(-2, 9)
~ temp dateScore = food + company
@joningold
joningold / list_pairkeys.ink
Last active November 19, 2021 05:29
Ink: here's a system that allows you to easily pair elements from two ink lists together - say, characteristics with people; weapons with materials; etc.
/*------------------------------------------------------------
RAWINT Keys
------------------------------------------------------------*/
LIST RawInts = RAWINT0 = 0, RAWINT1, RAWINT2, RAWINT3, RAWINT4, RAWINT5, RAWINT6, RAWINT7, RAWINT8, RAWINT9, RAWINT10, RAWINT11, RAWINT12, RAWINT13, RAWINT14, RAWINT15, RAWINT16, RAWINT17, RAWINT18, RAWINT19, RAWINT20, RAWINT21, RAWINT22, RAWINT23, RAWINT24, RAWINT25, RAWINT26, RAWINT27, RAWINT28, RAWINT29, RAWINT30, RAWINT31, RAWINT32, RAWINT33, RAWINT34, RAWINT35, RAWINT36, RAWINT37, RAWINT38, RAWINT39, RAWINT40, RAWINT41, RAWINT42, RAWINT43, RAWINT44, RAWINT45, RAWINT46, RAWINT47, RAWINT48, RAWINT49, RAWINT50, RAWINT51, RAWINT52, RAWINT53, RAWINT54, RAWINT55, RAWINT56, RAWINT57, RAWINT58, RAWINT59, RAWINT60, RAWINT61, RAWINT62, RAWINT63, RAWINT64, RAWINT65, RAWINT66, RAWINT67, RAWINT68, RAWINT69, RAWINT70, RAWINT71, RAWINT72, RAWINT73, RAWINT74, RAWINT75, RAWINT76, RAWINT77, RAWINT78, RAWINT79, RAWINT80, RAWINT81, RAWINT82, RAWINT83, RAWINT84, RAWINT85, RAWINT86, RA