esolang

Cood

Code and food, a tape machine you program by ordering in a restaurant.

Turing complete: yes · ●○○ easy · esolangs.org

Tested with 4 known programs · Hello World on Try It Online: identical · Test method

Run it

Expected: Hi

The idea

Cood spells a brainfuck-like tape machine as things you say to a waiter. Each line is one phrase. I want this. adds one, What do you have for dessert? moves right, and I'm very hungry. prints. A program starts with Hey, waiter! and may end with The bill, please.

Read the story

It is kinder than brainfuck in a few ways. I want 72 of this. sets a cell in one line, How much is it? prints a number in decimal, and input arrives as a whole number.

The machine

65,535 cells holding whole numbers, with the pointer starting at cell 32,767.

PhraseDoes
I want this. / I don't want this.Add 1, subtract 1
I want N of this.Set the cell to N
More N of this. / Less N of this.Add N, subtract N
I hate this.Set the cell to 0
What do you have for dessert? / ...for tidbit?Move right, move left
I'm very hungry.Print the cell as a character
I'm hungry.The same, then a line break
How much is it?Print the cell as a number
May I ask something?Read a line of input as a number
What do you suggest? … Nothing more?Repeat while the cell is not 0
Know a joke? …A comment

Punctuation is optional and I am works as well as I'm. The loop is tested at Nothing more?, so its body always runs at least once.

Example

The second is the sum.
Expected: 5

The second is the sum. It reads two numbers into two cells, then moves one from the second cell to the first until the second is empty, and prints the first in decimal.

Patterns it teaches

  • Camouflage: a tape machine dressed as small talk with a waiter.

Further

Also in Camouflage

Write your own in Run Convert a program from Cood

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: cood.

Command line

shib run cood -e 'I want 65 of this.
I am hungry
The bill, please.
I want 66 of this.
I am hungry'
shib manual cood

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/cood.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org