Here's the code if you want it, scroll down to have a play. This code was undoubtedly sourced from karen ann's great github archive.