28 August 2012

An arbitrary L-system

In CSC2003S (game design) today we had a brief look at L-systems.  In particular we examined this L-system for a turtle:
  • ω: xF
  • P_0: x<F → yF+(30)xF
  • P_1: +(a) → +(a-2)
  • P_2: y<F → FF
where F represents drawing a segment and +(a) represents turning a degrees.  Other symbols are ignored by the turtle.

For up to 30 iterations, this makes a pretty cool sort of flattened spiral.  Once you pass that, though, it also circles the other way, and once you reach around 60 iterations things just get weird as the angles eventually become acute, then finally wrap back to 30.

Have a look at some code I wrote to evolve and draw the L-system.  You'll need Python >2.6 installed to run it.

Here's a screenshot with 100 iterations.

20 July 2012

Making the Arduino Leonardo work with Windows 8

Look what arrived today!


Time to build and code awesome things!  ...Except that I'm running Windows 8 Release Preview 64 bit.  This makes things awkward.


I had downloaded the Arduino software, and I knew from the official instructions that the driver had to be installed manually, but I didn't expect the runaround required to do it.  So here are some unofficial instructions to avoid future suffering of others.


(I don't know if this works or is needed for other versions of Windows 8, but I would guess so.)


First, disable enforcement of driver signatures (thanks to Xark on #arduino for the link - very cool people over there).  The contrived chain of things to click goes as so:

  • Settings
  • Change PC settings
  • General
  • Restart now under Advanced startup
  • (wait for a reboot)
  • Troubleshoot
  • Advanced options
  • Windows startup settings
  • Restart
  • (wait for a reboot again)
  • Disable driver signature enforcement
Now Windows will start up and let you install the drivers.  The process for this is also not totally obvious, so here it is:
  • Start
  • Control Panel (type to search for it - much faster)
  • Hardware and Sound
  • Device Manager under Devices and Printers
  • Right-click Arduino Leonard under Other devices
  • Update Driver Software...
  • Browse my computer for driver software
  • Browse... and find where you downloaded the Arduino software
  • Include subfolders
  • Next
Then it finds the drivers all nicely and tells you that it's done and you can close everything.

One last thing to remember is the slightly fiddly procedure when uploading a sketch to the Leonardo.  Now go forth and make amazing things!

19 July 2012

The dawn of a new era

Term is starting soon
I have created a blog
See what I did there?

Back to the busy life of university.  Exciting enough to warrant a haiku (constant-width no less).

Anyway, I've decided to start this blog for a few reasons.  Firstly, and most significantly, I was frustrated out of my mind with prerelease software crashing on me and I needed to do something to distract myself.

Secondly, I'm attempting to get my name out there early, write useful stuff that people want to read, all that.  That sort of thing is all the rage with the tech startups at the moment.  I'm going to start doing this by posting about computer science (and maybe maths) assignments.  I'll probably release my code after each one.

And thirdly, science.  I want to see if I can keep it up.

So go on, tell all your friends doing CSC2002S, CSC2003S, or MAM2000W.