Parking lot

From Esolang
Jump to navigation Jump to search

Parking lot is an esolang invented by User:None1, inspired by Thief, Police and the Building.

Memory

There is a finite 2-D grid called the parking lot, every cell is a parking place.

Commands

All values are integers in the Parking lot language.

The parking lot has x rows and y columns

Defines the size of the parking lot, this command must exist and only exist at the start of the program.

There's a car at (x,y)

Creates a car, it initially faces right and has a speed of 0. After this command, the previous car (if it exists) becomes immutable. Immutable means that commands that move the car, change the properties of the car or parking the car are forbidden. Coordinate (x,y) stands for the x-th row from the top and the y-th column from the left.

The car's speed becomes v
The car rotates clockwise
The car rotates counterclockwise

They explain themselves, but note that the car's speed must always be positive and strictly less than 299792458 (the speed of light).

The car drives for t seconds

Moves the car t*v (v is the speed of the car) parking places in its direction, it is forbidden for two cars to be in the same parking place. The car cannot go outside the parking lot.

The car pays $x to park

x is a positive integer, this command places the integer x on the parking place the car is at. After this command, the car becomes immutable.

After all the commands are done, for every row, all the parked cars have their integers in the corresponding parking place printed as ASCII in order (Rows with no integers are ignored). After a row is printed, a line feed is printed. For example, if the parking lot has 3 rows and 3 columns and the parking places look like this (* means no integers in the parking place):

* 65 *
66 67 *
100 * 101

Prints:

A
BC
d

Errors

When attempting to do an invalid operation (e.g.: Going outside the parking lot) or the program has a syntax error, the error message Look! There is a car accident! is printed and the program halts.

Examples

Hello, World!

The parking lot has 1 rows and 13 columns
There's a car at (1,1)
The car pays $72 to park
There's a car at (1,2)
The car pays $101 to park
There's a car at (1,3)
The car pays $108 to park
There's a car at (1,4)
The car pays $108 to park
There's a car at (1,5)
The car pays $111 to park
There's a car at (1,6)
The car pays $44 to park
There's a car at (1,7)
The car pays $32 to park
There's a car at (1,8)
The car pays $87 to park
There's a car at (1,9)
The car pays $111 to park
There's a car at (1,10)
The car pays $114 to park
There's a car at (1,11)
The car pays $108 to park
There's a car at (1,12)
The car pays $100 to park
There's a car at (1,13)
The car pays $33 to park

Quine

Look! There is a car accident!

XKCD Random Number

The parking lot has 299792458 rows and 11 columns
There's a car at (1,1)
The car rotates clockwise
The car's speed becomes 299792457
The car drives for 1 seconds
The car rotates counterclockwise
The car's speed becomes 2
The car drives for 5 seconds
The car pays $52 to park

Eventually, the car's position is (299792457,10).