3D model of BF Engine

Overview

This is a BrainF*** (aka BF) engine built using LEGO® components. It uses another project of mine, the LEGO® Paper Tape Drive as its program store. The system uses a simple paper tape with coloured rectangles and the RGB sensor block from the MindCub3r by David Gilday to provide nine "commands". These commands represented the operators < > [ ] + - , . EOF.

BF Transliteration

The 8 BF commands are represented by colours on the paper tape. These map to:
CommandColour
+ 
- 
[ 
] 
< 
> 
, 
. 
EOF 

An example program to multiply two numbers together:
          , > , < [ > [ > + > + < < - ] > [ < + > - ] < < - ] > > > . X

Building

The build instructions are available as a PDF, or LDraw file if that is preferred, from the resources section below. It should be noted that this cannot be built from just the 31313 kit alone as it uses extra parts that I obtained from the 45560 Educational Expansion Kit, and some parts bought that would be found in the 45544 Core Set (the treads and sprockets used for the bit "flipper" arm.

For the colour sensor you will also need the RGB colour sensor block from the marvelous MindCub3r site. This should be available from the ColorSensorRGBBlock sub-section.

Input and Output

The I/O system uses the 8 grey "toggles" on top of the engine. These represent the high and low nybbles of the 8 bit memory. Bit 0 is closest to the "home" position of the flipper/detector arm, and bit 7 is furthest away.

When input is requested the engine will say "analyse". Set the bits as required and then press the middle button on the EV3. The arm will test each bit, storing the result in the current memory position in the BF computer. Once all the bits are read the engine will say "detected".

When output is to be presented the flipper arm will toggle all the bits that require changing, and then say "ok". Press the middle button again for the program to continue. Note: The system zeroes the bits at the start and assume that no bits will be changed between I/O steps. It remembers the last known position of the toggles/bits so that it only needs to change the minimum number of bits on new output.

Video

A video of it at work is on G+: BF Engine video

Resources

Feedback

If you have any feedback on this project, documentation, code or any other aspect, feel free to contact me via email at lego <@> jander [dot] me [dot] uk.

Permission to use

I'm releasing this design and the EV3 code under the Creative Commons licence below:

Creative Commons Licence
LEGO® BF Engine by Jerry Nicholls is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Based on a work at http://jander.me.uk/LEGO/bfengine.html.

Other Projects

Back up to my LEGO® projects.

Disclaimer

LEGO® is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this site.