When the going gets weird, the weird turn pro. - Hunter S. Thompson

21 March 2006

HOWTO: Compare thee to a summer's day

A geek with literary inclinations (or a poet with geekly inclincations) has translated one of Shakespeare's most famous sonnets into code.

First, a snippet of the original:
Shall I compare thee to a summer's day?
Thou art more lovely and more temperate.
Rough winds do shake the darling buds of May,
And summer's lease hath all too short a date.
And now, the code example... just the bit where the author sets up the variables, not the actual comparison (which comes later):
var summer:Object = {};
var thee:Object = {};

summer.name = "Summer Day";
thee.name = "Thee";

summer.lovelyness = 9;
thee.lovelyness = 10;

summer.temperature = 98;
thee.temperature = 98.6;

summer.lease = new Date(2006, 7, 31).getTime() -
new Date(2006, 5, 1).getTime();
thee.lease = new Date(2042, 6, 12).getTime() -
new Date(1970, 8, 25).getTime();

summer.complexion = 0xFFCC33;
thee.complexion = 0xFFCCCC;

summer.fair = 10;
thee.fair = 10;
William Shakespeare's Sonnet 18 - ported to ActionScript 2.0 by Satori Canton

Hat tip: Boing Boing

No comments: