esolang

Drive-In Window

Like Chef, except you are ordering the recipe.

JWinslow23, 2013 · Turing complete: with unbounded memory · ●○○ easy · esolangs.org

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

Run it

Expected: 4

The idea

JWinslow23 made Drive-In Window in 2013. A program reads like an order at a fast food window. It opens with a greeting and a menu, the people in the car order food, and they pay, which prints something. It ends with the bill.

Read the story

The menu is where the numbers live. Every item has a price that never changes, and sides can be added to an item or held back. The people are the variables. Each one holds a single byte, and "Person 2 will pay for his order!" prints that byte as a character.

The machine

LineDoes
Hot Dog: $50A menu item or a side, before May I take your order?
Person N would like the Item.Set person N to the price
… with the Side. / …, hold the Side.Add or subtract the side's price
Person N would also like … / would not like …Add to N or subtract from N instead of setting
Person N would like what Person M has.Copy M into N
Person N needs 7 dollars more for his order!Add 7 (or less to subtract)
Person N will pay for his order!Print N as a character
OK, what should Person N get?Read a character into N
OK, how much money should Person N have?Read a number into N
Let's just do this until Person N has no more money! … Person N has no more money!Loop while N is not 0
OK, that will be $1.95. Thanks for coming!The end

Values run from 0 to 255 and wrap around. Every person starts at 0. Since each person is one byte and a program names only so many people, it is a bounded machine.

Example

The first is the random number, after the xkcd comic.
Expected: 987654321

The first is the random number, after the xkcd comic. A $50 hot dog with $2 of relish is 52, the code of 4. In the second, person 1 holds 57, the code of 9, and person 2 counts nine rounds.

Patterns it teaches

  • Camouflage: byte cells and a while loop, dressed up as a meal order, like Chef is dressed up as a recipe.

Further

Pseudonatural

Cell-based

Write your own in Run Convert a program from Drive-In Window

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: drive-in-window.

Command line

shib run drive-in-window -e 'Hi, welcome to Random_Number_Generator. Here is a menu.

Hot Dog: $50

Here are your sides.

Relish: $2

May I take your order?

Person 1 would like the Hot Dog with Relish.
Person 1 will pay for his order!

OK, that will be $52. Thanks for coming!'
shib manual drive-in-window

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/drive-in-window.js

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

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