Wednesday, August 17, 2011

Visual brainfuck

"Rule #1 about Visual brainfuck is you do NOT talk about Visual brainfuck"

Visual brainfuck is an Integrated Development Environment for brainfuck and Ook! applications. It has a GUI with the following key components:
  • Three text editors: Input, Output and Program.
  • A Debugger with:
    • An animation with Memory Tape and a Program Tape watches.
    • Currently executed instruction indicators embedded in the Program Editor.
    • Breakpoint support.
    • Continuous and step execution.
    • Peek & Poke Controls.
    • The ability to display memory values in decimal, hex or ASCII.
  • A Component Palette that looks just like Delphi's or C++ Builder's.
  • A Text Encoder application that generates a brainfuck program that prints the desired text.
  • An Ook! Translator application that translates from brainfuck to Ook! and the other way around.
  • A brainfuck compiler for generating executables. This is particularly useful when the code is too dense for the debugger to run quickly.
  • A thoroughly detailed help file.
Here's a screenshot of the well-known Sierpinski triangle brainfuck program running in Visual brainfuck.

This is how Visual brainfuck looks.

There's a particular program I like in brainfuck: Conway's Game of Life, implemented by Linus Akesson. Here's the brainfuck program. Go ahead and try it in Visual brainfuck!

Feel free to download Visual brainfuck and join the few fine esoteric developers around the world. Hopefully we'll make it to... 27?

_______________________________________________________________________________
So what's the story behind Visual brainfuck?

Like I said earlier, I'm a big fan of esoteric programming languages. Some for amusement, some for the real challenge they become. The esoteric programming language that I particularly haven't been able to get over is brainfuck. brainfuck brainfuck brainfuck.

Back in 2003 I started to work as a hardware coder, and I asked my boss to give me 2 weeks to get familiar with Borland C++ Builder. In these 2 weeks, I was supposed to make a project of my own. And I made Visual brainfuck.

Visual brainfuck started as a joke (just like brainfuck), but after lots of coding, I started to actually achieve my goal and got acquainted with Borland's IDE, which by the way, I consider one of the best IDEs ever made. I learned so much about events, buttons, windows, threads, the Windows API, splash screens, etc.
Bottom line: If you ask my then-boss if he had the chance to hire me again, would he let me waste 2 weeks again, he'd probably say yes.

I was ready to release Visual brainfuck. I composed an email I was ready to send to my beta testers, people I'd met while learning how to put the project together. I started to learn how to make a help file and an installer for my application.

But something terrible happened: Procrastination. My 2 weeks were up, and I said to myself: "I'll finish it at home on my free time".
I still have the call for beta testers draft in my email.

Procrastination is a BIG cancer in our lives. Have you remembered about something you must do and said "I'll do it later"? Have you found yourself saying "Oh poor me, I never have time". Have you seen tihs popular and proud Tshirt?
 
Procrastination's a way of life

Now, about three weeks ago (august, 2011), I couldn't stand it anymore and decided to deal with this unfinished business once and for all. First, I had to dust my source code and figure out what I was thinking while coding. It was fairly commented, but a little more would've been nice. Moral: There's no such thing as enough comments in your code.

Oh, but I used special fancy controls for my project. For example, Visual brainfuck has a debugger with a cursor that indicates the currently executed instruction, plus a gutter where a green arrow points to the executed instruction and where line breakpoints are set. These controls needed to be installed, which meant lots of work. I even asked a friend who worked with me on that project back in 2003 and he said "that's old school. It's been almost 10 years, get over it!" Anyway, I finally got the development up and running.

I had horrible synchronization issues in two of my threads, but I fixed them by re-learning about threads and semaphores.

I always intended to include a brainfuck-native microprocessor called brainfuck uP along with Visual brainfuck, but decided to release it separately. I'll make a dedicated post about it here.

I upgraded the version of Visual brainfuck by two tenths because of two major improvements made now (2011). The first being the conditioning of the whole GUI for Windows 7 compliance (x86 and x64), and the second took some time:

I was telling two of my friends about Visual brainfuck, but when they asked what exactly it was, I couldn't say it's an IDE because it didn't have a compiler. So I decided to add a compiler to it. I didn't make the compiler, but I went out there and googled for compilers. The first I used and integrated to Visual brainfuck was the brainfucked compiler, a great, great optimizing compiler, but it makes .com executables which aren't compatible with Windows 7 x64. The search was very exhausting, and then I found the Brainf***.NET compiler, a very promising one, but I couldn't build it properly, and when I finally got to build it, I got some nasty runtime errors. Finally, I found and decided to use the Brainfuck.NET compiler, by Syschikov Andey.

During all this work I made a help file and an installer, which wasn't as easy as it sounds. I used HelpNDoc and Inno Setup.

After a three-week ordeal, I've finally released Visual brainfuck version 1.2.

I'm very proud of all I've achieved with this project. And I'm even more proud of having actually finished it! My best advise for anyone is Finish what you started. You'll feel great!

________________________________________________________________________________
I want to publicly thank my wife for her patience while I was sunken in this project :)

8 comments:

  1. Borland C++ Builder for life!!!! It may be old but who gives a fuck!

    ReplyDelete
  2. What an awesome tool you made! VBF is very good answer to the rapidly growing BF market. According to British Scientists number of brainfuck developers would double every year and it would become world's most popular language in next decade. There also should be LLVM BF compilers and FBJ for JVM and BF.NET for dotNet so your IDE would have serious competitors soon..

    ReplyDelete
  3. I am creating a simple language that will compile to brainfuck. Still in its early stages but there's a sample program that works.

    http://code.google.com/p/brainfuck-compiler

    ReplyDelete
  4. >[-]<[-]>+++++++++[<++++++++++>-]<---.>+++++[<+++++>-]<-.
    +++.-------.++++++++.>+++++++++[<--------->-]<--.
    >+++++++++[<+++++++++>-]<--.-.>+++++++++[<--------->-]<+++.
    >+++++++[<+++++++>-]<-----.>+++++[<++++++>-]<-.
    +++++.+++++++.+++.>+++++++++[<---------->-]<++.
    ++++++++.>+++++++[<+++++++>-]<----.+++++++++++++.
    >++++[<+++++>-]<-.-------.++++++.+.>+++++++++[<--------->-]<+++++.
    ---------.>+++++++++[<++++++++++>-]<---.--------------.
    +++++++++++.------------.>++++++++[<--------->-]<.
    >+++++++[<++++++++>-]<-.>++++[<++++>-]<++.
    +++++.---------.>++++++++[<-------->-]<----.

    Works on Linux (Ubuntu) with Wine!

    ReplyDelete
  5. Why isn't it available now? Can i get it from somewhere else?

    ReplyDelete
    Replies
    1. Hmm... something wrong with dropbox. I moved it to skydrive. Thanks for letting me know!

      Delete
  6. How do you run? I can only push it step by step...

    ReplyDelete