Assembly Line

From Esolang
Jump to navigation Jump to search

Assembly Line is an esoteric programming language invented by User:EvyLah. The creation of this language was inspired by the generic tycoon games on Roblox.

Here's an example "Hi!" program to show what it looks like:

|--H  |--i   |--!
|v _  |v _   |v _
|     |      |
|>>>S |>>>>S |>>>>>S
--------------------

Everything in Assembly Line must be connected to a floor in some way. This includes the sell pads, conveyor belts, droppers, and machines (see below for what those are). The line of dashes is the floor, and you can have multiple. Floors do not have to be connected to each other. Notice how the droppers (v) and value presser machines (_) are all connected together using either a dash or pipe character.

If a "building block" like a conveyor or machine falls (isn't held to the ground), the program will raise an error.

Terminology

This will be helpful for explanations later on.

Word Definition
item The "dot" of the program. It's like AsciiDots, but with gravity. They can hold negative numbers, floating-point numbers, but only numbers.
block A single text cell in the program. Like having 134 would take up 3 cells.
building block An element of the program (ex. one whole conveyor belt, a dropper, a machine).
operation block A [ ] structure that takes two items as input from the sides and outputs one in the middle after doing an operation inside.

Code execution

An "item" is created wherever there is a dropper. Droppers will only drop once, but can be activated another time if an item passes through a drop command (A).

Items

Items are affected by gravity. If an item hits the floor or falls outside the program, then it will simply be deleted.

While moving, items require at least one block of space, otherwise they will run into other things and get stuck! If two items hit each other from opposite directions (example below), then they will get stuck forever.

|v      v| Notice how the items
|        | will eventually meet
|>>>><<<<| up and get stuck
---------- forver.

Conveyor belts

Conveyor belts will move items. Use the greater- and less- than symbols to form conveyors. Items will fall above them. Every "block" of conveyor belts will fall together. Conveyors don't have to go just left or right. They can go diagonal. Here's a diagram (. represents an item):

|v
|.
|>>>>>>>
--------
|v
| .
|>>>>>>>
--------
|v
|  .
|>>>>>>>
--------

And so on...

Here are some more examples of conveyor belts: Left and right:

      v-|-v
<<<<<<<<|>>>>>>>>
-----------------

Diagonal:

|v    >>>>>>
|    >------>
|>>>>-|----|->>>>>
-------------------

If an item hits the diagonal section, it will be able to detect where the upward or downward conveyor belt is. If both are present, then it will just go up. In this example, the item would go up.

|v
|     >>>>
|>>>>>----
|----->>>>
----------

Here's a fun example of conveyors:

                     v|
|v                    |
|              <<<<<<<|
|>>>>>>>>>>>>  -------|
|------------         |
|                     |
|v     >>> <<<<   >>> |
|     >--- ----  >--- |
|>>>>>-         >---| |
-----|>>>>>>>>>>----| |
     ---------------|-| <--------------\
All items in this example will end up here.

I/O

Well, storing numbers isn't very useful. We need to output them to make it at least decently useful.

You can use sell pads for that! When an item goes over a sell pad (which has to be on the same level as the conveyor), the item will be "sold" and its value will be outputted to the console. There are two ways to output an item's value:

S (uppercase) as a Unicode character
s (lowercase) as a number

Instructions

Item creation

Command Name Description
v Dropper Spawns an item at its location. Can be triggered using an Activate Dropper (A) command.
A Activate Dropper Activates all Droppers when an item passes through it.

Item manipulation

Command Name Positition Description
_ Value presser 1 above item "Presses" the value of the character above it's Unicode to the item below it. If you want numbers, use 0-9. They normally would have the value of 48-57.
U Upgrade Item passes through "Upgrades" the item by doubling its value.
u Downgrade Item passes through "Downgrades" the item by halving it.

Math

A math operation is done like this:

|v         v|
|    [?]    |
|>>>>> <<<<<|
|           |
|---->>>S---|
-------------

where ? is replaced with an operation.

When one item gets to one side of the operation block, it will wait until another item is at the other side. Once both items are there, the program will evalute this:

first item arrived (operation) second item arrived

So, you can switch the order of subtraction just by delaying one item!