Birthday code
Nov. 23rd, 2007 11:13 pmThis is what I was doing last night that kept my hands too busy to blog:

It's a birthday card for my office-mate, who was giving a talk today celebrating 40 years of programming. I'd been thinking of making a cake along these lines, but I ended up not really having time (and somebody else was planning to buy cake anyway, and I rationalised the running-out-of-time with the realisation that it would be setting a dangerous precedent if I started doing cakes for colleagues' birthdays).
Originally I wanted the punched card to represent the code for (e.g.) "print 'Happy birthday'", but I couldn't work out how to convert code to card-punches, and couldn't source the knowledge from within my social circle. One person I asked did offer the following code:
BEGIN
FILE F (KIND=REMOTE);
EBCDIC ARRAY E [0:11];
REPLACE E BY "HAPPY BIRTHDAY!";
WHILE TRUE DO
BEGIN
WRITE (F, *, E);
END;
END.
Which looked familiar from wikipedia (where I got the punched card design, too). It also looked wrong (the length of the array was still set for "HELLO WORLD", not "HAPPY BIRTHDAY"). So I corrected that and included it inside the card, and made the hole 'punches' (cut by hand with a craft-knife) purely decorative, spelling out "HAPPY BIRTHDAY". Hence not being able to do a 'B' (I got into what I thought was an irrecoverable mess with the shape/size of the letters, but sorted it out in the end).
Do you know how many numbers you have to write to produce an 80-column punched card? And how many holes you have to cut out to make it say 'happy birthday'?
But he was absolutely delighted, and that made it all worthwhile.

It's a birthday card for my office-mate, who was giving a talk today celebrating 40 years of programming. I'd been thinking of making a cake along these lines, but I ended up not really having time (and somebody else was planning to buy cake anyway, and I rationalised the running-out-of-time with the realisation that it would be setting a dangerous precedent if I started doing cakes for colleagues' birthdays).
Originally I wanted the punched card to represent the code for (e.g.) "print 'Happy birthday'", but I couldn't work out how to convert code to card-punches, and couldn't source the knowledge from within my social circle. One person I asked did offer the following code:
BEGIN
FILE F (KIND=REMOTE);
EBCDIC ARRAY E [0:11];
REPLACE E BY "HAPPY BIRTHDAY!";
WHILE TRUE DO
BEGIN
WRITE (F, *, E);
END;
END.
Which looked familiar from wikipedia (where I got the punched card design, too). It also looked wrong (the length of the array was still set for "HELLO WORLD", not "HAPPY BIRTHDAY"). So I corrected that and included it inside the card, and made the hole 'punches' (cut by hand with a craft-knife) purely decorative, spelling out "HAPPY BIRTHDAY". Hence not being able to do a 'B' (I got into what I thought was an irrecoverable mess with the shape/size of the letters, but sorted it out in the end).
Do you know how many numbers you have to write to produce an 80-column punched card? And how many holes you have to cut out to make it say 'happy birthday'?
But he was absolutely delighted, and that made it all worthwhile.