At the risk of attracting too much attention to the reoccurring use of the “f” word on my blog, I have decided to pursue yet another BF-related project.
During the writing of my last post, I noticed how well BF could be used to define the behaviour of Turing Machines. A turing machine is essentially a simple conceptual machine that consists of the following:
- An infinitely long tape of cells that each contain a value.
- A “head” that can be positioned over any given single cell.
The “head” can read or write from the value it is positioned over, and the “behaviour” of the machine dictates how it manipulates the values on the tape (if at all!).
I decided to build a little web application with two ideas in mind - firstly, to create a nice IDE to visualise Brainfuck development better. Secondly, to implement a Turing Machine that uses Brainfuck as it’s behaviour definition language.
If you’d like to have a play then here it is: http://work.damow.net/random/bf-turing/.
The web application I came up with is essentially a Brainfuck parser similar to the one I wrote before in PHP, but with a tape-style visualisation of the pointer slots.
Changes I’d like to add in future are a speed control for the parsing and perhaps a small ID for each cell to make debugging your BF “applications” (ehem…) easier.
Until next time! (And I promise the next post will be rated “U” for all audiences).