Pistons & Pistons

From Esolang
Jump to navigation Jump to search

Pistons & Pistons (hereafter used as Pi&Pi), is an esoteric programming language made by User: Areallycoolusername. It utilizes the Unicode White Square characters, (▢), the (├) symbol, the symbol (┬), the ( ┤) symbol, the (┴) symbol, and all the characters on the ASCII character table from decimal value 32 to 126.


As specified before, Pistons has to use the square and the four box drawing characters to create a program along with ASCII characters. The square, along with one of the four characters must be combined in the shape of a piston. For instance:


Pistons are used to “push” characters onto the screen, and push other pistons. This is done by placing either a character or another piston directly in front of a piston. Such as:


This program pushes “x” onto the screen. In order to improve clarity, Pi&Pi has a simple syntax. Pistons cannot push pistons that are directly opposing them, e.g:


or characters that are Unicode, (excluding the Pistons, even though they are made of Unicode characters), or characters that are outside of the range of the ASCII table from decimal values 32 to 126. On the first line, either a right or down-facing piston must be placed first, allowing for more pistons and characters to be placed in the program. In order to activate a piston, it must be pushed by another piston, whose activation is a result of a piston being pushed by the first piston in the program.


.Pistons can also be activated by ASCII characters being pushed into the screen by other pistons, as shown in the second splitting example. As shown above, the first piston in the program pushes the second piston, thus activating it, and pushing x onto the screen. The first piston in a program cannot be pushed. Comments in this language are signified by the “!” character.


This language can be used to make a hello world program, a (highly tedious) 99 bottles program, and infinite loops (loops can’t end in this language). However, the wiki dosen’t seem to be able to properly print the code, so the examples are very wonky. In order to see the proper examples, look at the source code of this page.

Infinite Loop

This loops indefinitely.

    ┬ ┴ 
    ▢ ▢ 
    ┬ ┴

However, While piston impulses can be split, they can only be split in this way (through a character):

Split example in Minecraft pistons. Output will be 'Hel' or 'Hle'.
▢┤H ▢┤e 

An example which outputs xx to the console forever:

xx infinite loop in Minecraft pistons.
  ┬  ┴

Hello World

This takes liberties with notation, which is difficult to align. It should be viewed with a proper monospaced Unicode font. It uses Hangul characters to squeeze pistons into single character spaces when required.

This shows an implementation of the pnp source in Minecraft pistons.
    ▢      ┴
    ┴    ▢┤l
 ▢├▢e▢┤모 ┬ ┬
 ┴  ▢  ▢┤▢ ▢
 ▢  ┴      r▢┤▢┤d
 ┴  ▢┤▢┤모 ┬    ▢
 ▢      ▢  ▢    ┴
 ┴      ┴  ┬    !
 ▢┤▢    ▢  ▢
   ┴    ┴  ┬
   ␠▢┤▢┤o  ▢
   ▢       ┬ 
   ┴       무


Pistons & Pistons and pistons may be turing-complete due to the fact that there are no limits to the amount of pistons and characters accepted in a program, (simulating an inbound tape), variables in the lang can be stored and doesn't have to be used, (simulating writing data on a tape), and variables in this "tape" can be output. Furthermore, infinite loops can be made, and, with each variable declared, the "tape pointer" will move forward, completing turing-completeness.


If an interpreter were to be made, a Pistons & Pistons file would have the extension ".pnp".