I have been studying partial differential equations recently, including the damped wave equation. I decided to try animating a particular (approximate) solution to the equation using the excellent Mathbox which I discovered a long time ago, but never got around to trying it out. You can see the result here: http://richiejp.com/wave.html, the line has an oddly satisfying wobble to it.

Advertisements

I made a new website for myself at richiejp.com which uses THREE.js to display an automata which places a series of adjacent squares of decreasing size. Why would I do that? Well, because I wanted a 3d website and decided I liked the idea of displaying a seamless undulating field of disparately sized cuboids. I tried to visualize in my head how I might go about doing this and came to the conclusion that writing some kind of automata would be the easiest method of satisfying my entirely arbitrary requirements. No doubt, someone has created the exact same automata before, but I reinvented it and quite enjoyed the process of doing so.

I decided to use THREE.js because I have been through tutorials on using WebGL and OpenGL before and decided there is no need for me to go through that again. I may want to implement my own shaders at some point, but I decided that THREE.js would facilitate that rather than get in the way. I didn’t use any other libraries just to keep things simple, in retro-respect it might have been quicker to use a language which compiles to javascript rather than use js directly or at least use jshint and do the basic things required for sane js development. At any rate I would recommend THREE.js.

Why not write code in LLVM IR? Well… there are probably lots of reasons, a lot of them self evident. Here is a program which outputs the nth term in the Fibonacci sequence: https://gist.github.com/richiejp/6417262. One can run it with “lli fib.ll” or it can be compiled to ASM with “llc -o fib.s fib.ll” and “gcc -o fib fib.s”. The fib.s file can be opened in a text editor so that one can see the generated assembly for one’s platform. When fib.s is passed to gcc it statically links it with the C standard library and adds a start reference so the ‘main’ methods gets run. At first I wasn’t quite sure why I was able to use functions from the C standard library when I hadn’t explicitly included it. The answer of course being that gcc includes it unless explicitly told not to, even if it is just being used as an assembler.

I uploaded Typogenetics to Github; https://github.com/richiejp/typogenetics.

So I briefly looked at my last blog post and I haven’t done much of what I said I would. I did however do a maths course and I have written an implementation of Typogenetics from Godel, Escher, Bach: An Eternal Golden Braid, in Javascript. Obviously I have done other things as well, but I don’t intend to blog about them. Writing Typogenetics was not easy and took longer than I expected, a great many hours in fact, I would like to say it took me a weekend or two, but that would be utter bullshit, it’s also not yet in a presentable state, so there is still work yet to do. Javascript is partially to blame for the difficulty of writing it and the fact I didn’t use any libraries, whatever they might be, to aid in actually processing the pseudo genetic codes probably didn’t help either. The point was not to do it as quickly and easily as possible though, that is for work.

Hopefully, probably, maybe I will find a way of presenting Typogentics in a way that is fun for someone, who is perhaps not even familiar with GEB, to play with it. Douglas describes it as being a solitaire game, but I tend to think of it as more of an automata. To really turn it into a game, with a goal other than exploring multiple levels of interrelated meaning in a single sequence of symbols, it needs something adding to it. I have ideas about what that might be, but they are rather grand ideas, so I think it best to first make the basic process of ‘typogenetic’ transformation transparent to the user. Then think about making it into a game someone with little interest in GEB might still pick up.

One thing I haven’t done yet is to investigate what other implementations of Typogenetics exist. This is very deliberate because, considering the popularity of GEB with programmers, I would assume it has been done and done very well. I wanted writing it to be an adventure, not simply a regurgitation of existing solutions. Of course whenever you write anything you are almost exclusively using ideas from your forebears, not to mention the fact I didn’t invent Typogenetics, but it is nice to carve out a little bit of invention of your own. Denying myself knowledge of other solutions gave me more freedom to do that.

Finally I might, may, possibly, non-committally swap this blog over to a nodejs based thing which can also host Typogenetics.

Hopefully I am going to write a NHaml view engine adapter for the Nancy web framework. So far I have managed to get my development environment set up under Debian. Nancy requires a version of Mono which is newer than what is currently in the Debian testing release (what I am using), so I had to re-install mono from the experimental repository.

NHaml compiled after making a couple of changes, but I haven’t tested it yet. I forked RussPAll’s repository and committed the changes to it, you can find it here: https://github.com/richiejp/NHaml

For a long time NHaml looked like it was dead, but fortunately Russell Allen decided he was going to take over the project and get it working on .Net 4.0

Personally I can’t stand writing HTML by hand and most view engines seem to espouse the view that templates should look like HTML. If anything HTML shouldn’t look like HTML; s-expressions are a good example of something which is easier to type and more flexible. The haml syntax is not exactly perfect in terms of flexibility, but it is very terse.

Speaking of s-expressions I do have half a mind to try using Iron Scheme as a view engine in Nancy, it would be interesting to see how that would turn out.

 

I put my 5 year old c examples on github and added links going to the gists on the article pages. I really like Github, it’s a shame I have been too distracted by shiny new languages to get a hobby project up on there.