Sunday, 16 March 2014

Computus 3

It's been a few years since my last look at calculating the date of Easter Sunday using only Z80 machine code, but I thought I'd finally re-visit it. In particular, I wanted to look in detail at Al Petrofsky's awesome optimizations of my lame attempts.



If you want a master-class in optimizing integer calculations on archaic CPUs (and who doesn't?) look no further than Al's solution. It's the product of deep understanding of:
  • The Z80 instruction set,
  • Integer multiplication-by-constants,
  • Integer division-by-constants,
  • Modulo arithmetic, and
  • Easter computus.
At only two hundred or so opcodes, and no branches, it's a beautiful distillation.

Saturday, 22 February 2014

Cocktail Venn Diagram

Many years ago, I worked on a project that involved creating a nice, clean database of alcoholic cocktails. That project never came to fruition, so the database has been languishing unused ever since. But then, on a Friday evening at work, we were discussing humorous data presentations whilst drinking cocktails. The two topics melded into an obvious question: "Has anyone done a Venn diagram of cocktails?"

The answer, according to Google Images, was "No!"

Then I remembered my under-used dataset, so I set to work coming up with some kind of Venn (or Euler) diagram. It turns out that these little blighters are quite difficult to construct beyond about four overlapping sets. Indeed, it is still a fairly active area of academic research.

I took my database of 289 drinks, and found the most common ingredients:
  1. vermouth (sweet and dry),
  2. gin,
  3. rum (dark and light),
  4. whisky,
  5. vodka,
  6. lemon juice,
  7. bitters (including Angostura),
  8. lime juice,
  9. orange juice, and
  10. brandy (including cognac)
I had planned to draw a diagram of those top ten ingredients, but quickly pruned it down to the six main, base spirits:
  1. vermouth,
  2. gin,
  3. rum,
  4. whisky,
  5. vodka, and
  6. brandy
This still turned out to be frustratingly difficult. But after an evening at the kitchen table with pencils and copious amounts of scrap paper, I came up with this:


It's almost symmetrical with the fortuitous but curious fact that no drink in my database contains both vodka and whisky.

A bit of time spent with Inkscape, JSON, HTML5 canvases and JavaScript allowed my to come up with an interactive web page demonstrating these intersections.

Saturday, 11 January 2014

RGB/HCY and RGB/HCL Corrections

Florian Mosleh was kind enough to take the time to send me an email highlighting some typos that had crept into my implementations of RGB/HCY and RGB/HCL conversions.

I've incorporated the fixes into the HLSL snippets and added functions for RGB-to-HCL and HCL-to-RGB (although there seem to be inherent problems with the HCL colour space).

Friday, 27 December 2013

Skeleton Alphabet 5

It's been a year and a half since my last post concerning Ann Camp's skeleton alphabet. But with a bit more time on my hands over the holidays, I thought I'd revisit it and add an interactive twist:


Again, there's no kerning and it's only been tested with Microsoft Internet Explorer and Google Chrome.

Sunday, 22 December 2013

Venn Diagram T-Shirt


A: Data that can be represented by Venn Diagrams.
B: Data containing groups with interesting intersections.

Sunday, 8 September 2013

Coat of Arms 2

A coat of arms for the 21st century (but a 20th century palette):


You can test it at ZXing.org.

Saturday, 7 September 2013

New Old Front Page

After many, many years, I've taken down my ancient Flash front page for the chilliant.com website, and replaced it with something even older:


For authenticity, I reverse-engineered the Teletext font from the Mullard SAA5050 datasheet: