Tag Archives: programming

Computers Like Rectangles

The other day I was at a friend’s house, and while waiting for the oven to preheat, I stumbled across a game I once played as a child, a triangular peg board where the goal is to remove pegs such that there is only one peg remaining. I was thinking of devising a program to attempt to solve the puzzle, much like my programming languages assignment last year to solve a slide puzzle. However, the more I thought about it, the more I realized how attached the conventional computer science paradigm is to rectangular data. It is almost too easy to write a program to play checkers (or at least manipulate the pieces on a board), but it is certainly non-trivial to write a simple and efficient algorithm the maintain the board state. I think it’s rather interesting how the problems we generally have to solve fit rather nicely into their little rectangles, and how few problems require other shapes.

For a solution to the peg board problem, I found this site that documents the author’s process and a code listing. If you’re interested in the game as much (or more) than that the programmatic solution, there are also a number of statistics for possible solutions on the site.

Peace and chow,


Time Really Flies!

I just made the discovery the other day that I’ve been on co-op for over a month, and time shows no sign of slowing down! For those of you who haven’t had the delight of hearing me expound on how much I love my co-op, I have really found a place where I fit in, am challenged everyday, and don’t have to do any tedious work, just cutting edge security research!

Anyways, now that I’ve gotten that over with, I was up at Clarkson the other week for the career fair, and I went up the night before for the COSI meeting. That evening a new member introduced a new project to add easy to use AI libraries to the Processing language. I thought that is might be a good idea to take a look at AI stuff before I take the class when I return, so I’m excited to dive in and learn what I can! Also, after learning how little I really know about virtualization, and seeing how popular it is, I thought I’d like to jump on the bandwagon and learn about it. Last night I bought Running Xen and its sister book The Definitive Guide to Xen and I proposed (through Zach) that to learn more about it, I’d like to form a rag tag groups of hackers and write our own, open-source virtualization application, whatever that entails. I hope to post soon as I start learning what I’m in for.

Peace and chow,


Surviving in the Desert

Being in the wilderness as I have, as a canoe trip leader, helps you adapt to uncomfortable situations. Recently, I was put into a less than desirable situation, programming in Windows. I thought it would be a good idea to learn how to survive on the dark side. I started with a stock Windows XP install, with all the fancy development tools, Visual Studio, WinDDK, sample code for Win32 programming, and a (relatively) open mind. As I started using it, the following became major annoyances:

  • The command line (cmd.exe) is horrible, not full screen, the history is bad, and it’s just plain ugly.
  • Visual Studio is a waste of space, it doesn’t even provide the ability to compile a file. That alone made me get rid of it.
  • The lack of multiple desktops make screen real estate very limited. Even with a sizable screen (27″) is makes looking up references a pain

So, to fix some of these woes, I did away with Visual Studio, edited the console preferences to take up much of the screen, and installed emacs, I then wrote some batch scripts which I put in the PATH to enable me to just type emacs foo.c, and ls instead of dir.

Now, I finally have a system that I can work with, it’s not great, but I’ll survive. Unforntunatly, developing on Windows is much like trying to glue a dead weasel onto a balloon — non-sensical and smelly. From my short exposure to the Windows system, I’ve found the following lacking:

  • The kernel memory layout
  • The poorly documented API
  • Lots of caps, and non-standard types, it’s like programming in old HTML.
  • The verbose and utterly convoluted device communications (IRPs?)
  • Complete lack of modularity (if my driver segmentation faults, I get a BSOD)

To sum it up, while it’s been an informative foray into the world of Windows, I think I’ll stick to slightly more sane and open operating systems.

Peace and chow,


FANG Version 0.1 Released!

I spent my birthday yesterday polishing up FANG for it’s initial release to the public, after adding some error handling so it would fail more gracefully and adding the ability to parse in files and save the current state of the system to a file for later retrieval. I also did away with the rather hideous use of the process dictionary and moved to an auto balanced tree structure for storing the data.

Over break, I’m hoping to add enough other features to warrant a 0.2 release, which I’d like to have support for soft-processes (ala Erlang), multi-node support and transactional shared memory (using Mnesia). I would also like to add permissions and process jailing for the soft-processes to allow for running untrusted code in a sandbox of sorts.

I’ve started a very simple (and ugly) site to put my progress and releases. You can check it out here and please comment with suggestions or other features you’d think would be a valuable addition. Good luck on everyone’s finals and projects! Have a wonderful break!

Peace and chow,


New Programming Language: FANG

For the past few days, I have been slaving away working on my latest creation: FANG, a programming language that I’m hoping will combine some of the best features I’ve found in my studies and remove some of the cruft. It will have scheme/lisp like syntax and Erlang like processes, and some other neat features from other languages I’ve come across. After this weekend, I have a rough start which supports variables, lambda functions, and auto-memoizing clean functions. You can download the source from SVN (username = password = anonymous) and check it out. Please feel free to comment with features to add, or things to change.

Features I want FANG to have:

  • Clean scheme/lisp syntax and macros
  • Lightweight processes and multi-node support
  • Arbitrary precision number support
  • Process jailing and permission setting
  • Simple networking and file I/O
  • Others I’m sure I forgot…

Code Examples:

  • (defvar ‘fib (lambda ‘(n) ‘(if (< n 3) (1) (+ (fib (- n 1)) (fib (- n 2)))))) – A plain recursive function that automatically will get memoized, so it’s rather speedy (use dirty-lambda to turn off the memoization)
  • (defvar ‘max (lambda ‘(a b) ‘(if (> a b) (a) (b)))) – A simple max function used in findset
  • (defvar ‘findset (lambda ‘(l) ‘(if (== (length l) 0) 0 (if (== 1 (length l)) (hd l) (max (+ (hd l) (if (== 2 (length l))) 0 (findset (tl (tl l)))) (findset (tl l))))))) – A function for a homework assignment to find the highest weighted independent set in a path
  • (defvar ‘fact (lambda ‘(n) ‘(if (== 0 n) (1) (* n (fact (- n 1)))))) – A memoized factorial function

Peace and chow,