esolang

Taxi

A program is a day's work for a taxi driver in the town of Townsburg. The data are the passengers, and you have to keep the tank full.

Sean Heber, 2005 · Turing complete: unknown · ●●● hard · esolangs.org

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

Run it

Expected: Hello, World!

The idea

Sean Heber made Taxi in 2005. There are no variables and no operators, only a map. Every operation is a place in town. Drop two numbers off at Addition Alley and their sum waits at the curb for you to pick up. Drop a string at the Post Office and it is printed. Strings wait at the Writer's Depot, numbers at Starchild Numerology, and the Babelfishery turns one into the other.

Read the story

Getting anywhere means giving directions. Go to the Post Office: north 1st right, 2nd right, 1st left. sets off north, takes the first right turn, the second right after that and then the first left, and drives on until the Post Office is on the road ahead. Wrong directions run you into a dead end.

The driving is real. The taxi does 18 miles to the gallon and holds 20 gallons. Passengers pay 0.07 credits a mile when they get out, and the gas stations sell fuel at three prices, so a long loop has to earn its own petrol. The day must end back at the Taxi Garage, or the boss fires you.

The machine

PlaceDoes
Writer's Depot, Starchild NumerologyA string or a number waits here
Post OfficePrints the strings dropped off; a pickup reads a line of input
Addition Alley, What's The Difference, Multiplication Station, Divide and ConquerArithmetic on everyone dropped off
The Babelfishery, Charboil GrillNumber to string and back, number to character and back
KonKat's, Chop Suey, Auctioneer School, Little League Field, Tom's TrimsJoin, split, uppercase, lowercase, trim
Magic Eight, Collator Express, Equal's Corner, Crime LabComparisons; a passenger waits only if the test holds
The UndergroundSubtract 1, and nobody waits once it reaches 0
CycloneEvery passenger comes back with a twin
Sunny Skies Park, Joyless Park, Narrow Path ParkQueues and a stack
Fueler Up, Go More, Zoom ZoomGas stations

Three passengers fit in the taxi. Switch to plan "x" if no one is waiting. jumps to the label [x] when the curb is empty where the taxi stands. With The Underground that makes a counted loop.

Example

TIO's Hello World picks up one string and delivers it.

TIO's Hello World picks up one string and delivers it.

"Hello, World!" is waiting at the Writer's Depot.
Go to Writer's Depot: west 1st left, 2nd right, 1st left, 2nd left.
Pickup a passenger going to the Post Office.
Go to the Post Office: north 1st right, 2nd right, 1st left.
Go to the Taxi Garage: north 1st right, 1st left, 1st right.
Expected: 42

The second program multiplies 6 by 7. The answer is a number, and only strings can be printed, so it rides to The Babelfishery first.

Patterns it teaches

  • Camouflage: a program reads as a list of errands in plain English.
  • Stack machines: the curb at each place is a queue or a stack, and the taxi moves values between them.

Further

Pseudonatural

Write your own in Run Convert a program from Taxi

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run taxi -e 'Go to the Post Office: west 1st left, 1st right, 1st left.
Pickup a passenger going to the Post Office.
Go to Tom'\''s Trims: north.
Go to the Post Office: south.
Go to the Taxi Garage: north 1st right, 1st left, 1st right.' --input 'Hello there
'
shib manual taxi

Source

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

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

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