Skip to content
This repository has been archived by the owner on Oct 16, 2021. It is now read-only.


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Brainfuck Game Engine

A work in progress game engine built to make use solely of the brainfuck language.


Insert funny 'an image is worth a thousand words' joke here, or something.


The game code is separated in two files: and The first is run only once, as to load a state to the tape, while the latter runs on every frame.

User input

Whenever the interpreter finds a , (comma) in the code, it reads whatever value is on the current cell and replaces it with the state of the corresponding input.

Valid values are listed below:

0 = Left arrow             => (0 = unpressed, 1 = pressed)
1 = Up arrow               => (0 = unpressed, 1 = pressed)
2 = Right arrow            => (0 = unpressed, 1 = pressed)
3 = Down arrow             => (0 = unpressed, 1 = pressed)
4 = 'A' key                => (0 = unpressed, 1 = pressed)
5 = 'S' key                => (0 = unpressed, 1 = pressed)
6 = X coordinate of mouse  => (0 to 24)
7 = Y coordinate of mouse  => (0 to 18)
8 = Mouse click            => (0 = unpressed, 1 = pressed)


The game screen is drawn according to the first 25 × 19 = 475 cells in the program tape after the first cell. They are equivalent to a grid on the canvas, where each value corresponds to a color:

0 = No change (shows the background color)
1 = Black (#333)
2 = Gray  (#ccc)
3 = White (#fff)
4 = Red   (#c33)
5 = Green (#3c3)
6 = Blue  (#33c)

Values wrap around, so a value of 7 would be equivalent to a 0 (background color), a value of 8 would be equivalent to a 1 (black), and so on.

Eventually, I'll figure out a way to allow people to change the default background color.


To quote intergalactically famous fictional scientist and inventor Rick Sanchez,

The reason anyone would do this, if they could (which they can't), would be because they could (which they can't)


As mentioned on the source code, full credits to copy for the initial code for the compiler, available online at I highly recommend a visit to copy's GitHub, everything is awesome in there.

I will most likely finish replacing the compiler in the future with one fully built by myself. However, for the moment, this should do nicely.


A brainfuck game engine -- because life wasn't hard enough before







No releases published


No packages published