Brainfuck: Enough Said

1. December 2010

Earlier today I put up a page explaining how a particular esoteric programming language works, as well as my interpreter for it. Brainfuck is not simply a name, but also an accurate description of what it takes to fully understand what the code is trying to accomplish. Given only eight symbols, this language is turing complete. This means that the language can accurately simulate any turing machine... i.e. executing under a defined set of rules, any computer algorithm can be completed. I've messed around with the language a bit and it is as its name suggests. In order to add two numbers together and display the result, you need to go through a command along the lines of "[->+<]>." where the number you started on was one cell to the left of the number you added it to. It proceeds by subtracting one from the left number and adding one to the right number until the left number is zero. If addition takes six commands, imagine what multiplication would take, nevertheless exponents or square roots. However complicated these commands might be, this language is capable.

I have yet to think of a good application for this language as opposed to other languages. I found myself asking why it was even created. To borrow a line from Wikipedia, it was designed to be a turing machine with the smallest possible compiler. Some people have been as efficient as to write a compiler that is only 200 bytes in size! Attached to the page is my version of an interpreter for this language. Although not nearly as small as 200 bytes, my interpreter comes with a few extra features than simply running the commands. As best as I can find, mine is the only one to let you type in a numerical byte instead of just a character off the keyboard. I hope I'm not the only one who finds this a good idea... Regardless, I also added in some switches to output particular information to files; information such as routing all output to a file and a memory dump of the stream that the command generated while it was being run. Source code and all is available in the article.

Project, Source Code ,

Uploaded New Projects

25. July 2010

I finally got around to it, three new projects for you all: Circle Library, RunOnTop, and MyMathLib! Written from scratch, these projects of mine are now available, source code and all, for you all to use or play around with.

My Circle Library is a simple set of two classes that offer similar functionality to Rectangle and RectangleF except the classes are for our perfectly round friends instead. Granting you options to tell if circles are overlapping, if one fully encircles another, or if they contain a point, these classes allow for some simple 2D collision detection. Also, and I'm not sure where this can be applied, but given two circles, you can find the Minimal Enclosing Circle which is the smallest circle that completely contains both circles. That one took me awhile, but it's working great.

I developed RunOnTop to force other programs to start and remain always on top. It's a great little utility app for Calculator, Notepad, a window of your favorite browser (Chrome!), or whatever you need. I admit it is one of my lesser tested applications, but it does what I want it to do on my setup of Windows (with UAC turned completely off). UAC may not reduce functionality of this program, but I haven't tested so I don't know. The code is based around a few methods of the WinAPI if you want to discover how low-level C# can go.

MyMathLib was a project to teach myself about interpreters and actually make one. It translates human written algebraic expressions first to Reverse Polish Notation and eventually to a final solution. It handles most, if not all, of the mathematical operations you would run across in a high school algebra/trig class.

You can find these projects on the right under Pages. Take your time and meander through the code, or just download and use them for your own personal needs. If you find you have a great use that I may not have mentioned for some of these projects,  let me know in the comments.

Development, Project

Wrapfield, Source Code and All

15. July 2010

I'm going to begin putting up some of my projects for you all to read, run, and use. First up, Wrapfield! A twist on the traditional click and flag game, Minesweeper has been taken to a new level with a new rule alongside all the original features. Take the code, learn from it, play the game, do what you want to do, but of course I ask you leave my name (and my buddy's name, Shawn) left in the about dialog box. You can find it on the right hand side under Pages or by clicking here.

More projects are on the way as I clean them up and prepare them for the site, although not all will contain source code such as this one. Also, I want to begin writing multi-part case studies where we walk together through complex projects facing decisions, possible fixes and their flaws, as well the optimal solutions for those problems. With complete access to the source code of the final project, and all the reasons behind the code as the project expands. Keep an eye out over the coming weeks as more projects and these case studies come to the site. Have a particular idea for a case study? Propose the idea in the comments, if I like it I may use it!

C#, Project, Source Code , ,