esolang

CAR#

Brainfuck where the pointer is a car on a grid. It can only drive forward and turn.

Niko Strauch, 2023 · Turing complete: unknown · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: Hello, cat

The idea

Niko Strauch made CAR# in 2023, after brainfuck. The memory is a grid of 1024 by 1024 cells and the pointer is a car. Brainfuck's two moves become three commands, drive one cell forward, turn right and turn left. The name comes from the car and the grid, which is the #. The specification's own interpreter is written in Python and comes with a dialog window.

The machine

CommandDoes
^Drive one cell forward
/ \Turn 90 degrees clockwise or counter clockwise
+ -Add or take 1 from the cell under the car
=Print the cell as a number
>Print the cell as a character
<Read a character into the cell
[ ]Repeat while the cell is not 0
{ }Repeat the inside as many times as the cell says

The car starts in the top left corner, facing down. { } is marked for version 2 in the specification and works as described. The specification leaves the edges open; driving off the grid is an error. Cells hold whole numbers without a limit, and the end of input reads as 0.

Example

The Hello World spends one line of + on each letter, 1,129 of them in all.

The Hello World spends one line of + on each letter, 1,129 of them in all. Each line ends with > to print the letter and ^ to drive on to a fresh cell. The cat reads a character, then prints it and reads the next until the input runs out.

A loop works as in brainfuck, but to reach the next cell the car has to drive there, and // turns it around to come back. This one adds 7 to the cell below six times and prints the 42 it made.

Expected: 42
Expected: Hi

Patterns it teaches

Further

Cell-based

Write your own in Run Convert a program from CAR#

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run car-sharp -e '<[><]' --input 'Hello, cat'
shib manual car-sharp

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/car-sharp.js

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

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