NaN value, supposedly standing for “Not a Number”.
Given that, what would you expect from
typeof NaN? Probably not
NaN === NaN gives
NaN !== NaN gives
NaN is not equal to itself!
And best of all, for some reason
NaN isn’t a constant, but a global variable. So if you want to change it to something else (e.g.
NaN = 'fishcake') you can. Anyone who does should probably be shot, but the fact that it can be done at all is baffling.
I’ve been playing with Flash some more, and have made the leap to pure AS3. I’m using FlashDevelop, which is a really great IDE – far better than Flash CS3 itself for writing code. It’s amazing what a difference a good editor can make.
Anyway this is what I came up with, a bit of a rehash of some old Blitz Basic demos I did long ago. Click to launch fireworks
Now I’m trying to learn flixel, a free AS3 framework designed for games. I’ve already made one basic platform game following a tutorial, and am now working on my own.
After much battling with ActionScript, this is the latest version of my Mandelbrot generator. Yes, it has skipped a few version numbers. New features:
- Rough rendering first, followed by a better quality one
- Various optimisations
- Information panel
- Actually being able to get back out again, without reloading the flash
- Doesn’t resize stupidly
- Just generally cleaner code
My Mandelbrot flash, now with (one-way) zooming. Click on a region to zoom in.
And while checking the lyrics to Mandelbrot Set for the title of this post, I found there is a Jonathan Coulton wiki! Sweet! Their article also confirmed my suspicion that the algorithm described in the song isn’t actually correct, it instead describes the production of a Julia set. Those are great though, and will probably be my next fractal project.
I’ve used Flash a fair bit before, but never made the jump from ActionScript 2 to AS3. It’s quite a big change, and since I’m so used to programming in the very forgiving Python, it seems really fussy. But my god it’s fast! Anyway I’ve always wanted to make a Mandelbrot generator, even back when I was programming in BASIC and really didn’t have the skill. So here we go:
mandelbrot.swf (Ignore the pixelation, it’s just being displayed at the wrong size.)
I’m really quite pleased with this as I had to learn quite a few new techniques. Obviously it’s rather static, I still need to add moving/zooming but that shouldn’t be too hard now. The colouring could use some variation too.
Also, using song lyrics for post titles seems to have unintentionally become a theme, so I’m going to run with it. :)