j4: (dodecahedron)
j4 ([personal profile] j4) wrote2007-11-23 11:13 pm

Birthday code

This 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.

[identity profile] oldbloke.livejournal.com 2007-11-24 06:13 am (UTC)(link)
If I'd known far enough in advance, I'd have sent you some real punchcards.
I don't need them for roaches anymore, coz I'm like all pure now innit.
With more warning, I'd have found a punch and done it for you. There's a manual one somewhere at our place, still - it was in my group's Black Museum about a decade ago, and I'm sure somebody's kept it.