From Esolang
Jump to navigation Jump to search

Trainfck is a language designed by Mujk. It's a concurrent, brainfuck inspired esoteric programming language with trains.


Trainfck is an esoteric programming language using a 2D map where trains run on rails. Trains depart from stations (+) and travel in all directions. There is no limitation on stations and therefore also not on trains.


When two or more trains collide, they crash. The program ends when all trains have crashed. Memory is managed in byte cells, as in brainfuck. All trains use the same byte cells. Because trainfck uses all the brainfuck operators, the language is turning complete.



The pointer points on the 3 cell. This byte can be increased or decreased now. The cell pointer and the cell value is controlled by the direction where a train passes a station, all other operators are on the rails.


  • + : station

train directions:

  1. up -> cell byte + 1
  2. down -> cell byte - 1
  3. right -> cell pointer goes to next cell
  4. left -> cell pointer goes to last cell
  • - | : rails, the train can only move on rails and operators, or they will turn around
  • ^ > < v  : changes direction at the next possible option
  • ! : ignores the next action if the current cells equals 0
  • . prints out the current cell
  • , takes input as value for the current cell


  • trainfck -> a trainfck interpreter written in Go