Monthly Archives: April 2015

My First Program from 1987

Back in 2010, I posted a brief story about one of the highlights of my childhood, the first time I was able to get a program to successfully compile and run on my Apple IIe clone, the Laser 128.

Here’s the tale again:

I was subscribed to a children’s magazine called “3-2-1 Contact” and in the back of every issue were a couple of programs in BASIC (as in the BASIC programming language). I can still vividly remember one of the most exciting and exhilarating moments of my childhood, perhaps of my whole life. The moment came after seemingly endless hours of trying to get the very first program to run. I knew nothing about how I was supposed to type it in, whether punctuation or case had anything to do with the code, whether the line number needed to be typed and I definitely had no idea what the code meant. Yet, I tried and I tried and I tried until finally, after pressing the “Enter” key at the “RUN PROGRAM”, something happened. Something beautiful. Something amazing. Something that made me jump up and down, hoot and holler, clap and do a little jig. Okay, specifically what happened was so basic and ordinary that no one but I would be impressed. It was the fact that it ran that made me so happy. The program just drew a multicolored box around the edge of the screen and then criss-crossed a multicolored “x” on the screen. It repeatedly drew the box and the x over and over again. It was essentially the most boring screensaver you could imagine. But, the code I entered ran. Brilliant! Genius! I still feel the excitement in my gut when I think about that moment.

from Chasing Rabbits in Stat Class (June 17, 2010)

So, today I was finally able to find the original code by digging around on the web.  I can’t believe I actually found a scanned image of the page from the back of the magazine, but here it is:

2015-04-20_19-23-34

And then, thanks to Joshua Bell, I was able to use an “Applesoft BASIC in JavaScript” utility to re-create that experience again: http://www.calormen.com/jsbasic/

Here’s the code to copy and paste if you want to try it out yourself:

10 HOME:GR
20 COLOR=1
30 FOR S = 0 TO 39
40 VLIN O,39 AT S
50 NEXT S
60 FOR S = 0 TO 39
70 COLOR = INT(RND(1)*232+1)
80 PLOT 0,S: PLOT S,S: PLOT S,0: PLOT 39,S: PLOT S,39: PLOT 39-S,S: PLOT S,39-S
85 FOR T=0 TO 100: M=T+100: NEXT T
90 NEXT S
100 GOTO 30

Note that I added line 85 just to slow down the rendering on the page.

Are you ready to see that amazing graphic that I created?  Again, let me just say that the moment this finally ran, I freaked out with excitement.  It was only after hours, if not days of trying to get that code entered correctly.  Seeing it again didn’t quite recreate that feeling, but I’m still feeling pretty proud of myself for being able to recreate the graphic from 1987.

Cheryl’s Birthday – Singapore Math Problem

This math problem went viral yesterday so I had my kids tackle it. It took us all working together but we got a solution.

Here’s the problem that appeared all over reddit, Facebook, and Twitter:

  

Don’t read any further unless you want to know the answer. #spoilers

Hint 1: Albert’s first statement rules out any month with a unique day (18 or 19) since he’s certain Bernard doesn’t know the exact date. If Bernard had been told 18, for example, that means he could know it was June 18, but Albert is certain Bernard doesn’t know so it couldn’t have been June that Albert was told. Same goes for May since the 19th is unique to May. 

Hint 2: With May and June ruled out, Bernard says he now knows what the full date is. So the day couldn’t have been one that is in multiple months (i.e., 14 is in July and August). So, the 14’s are ruled out. 

Final Hint (aka the solution): Since Albert finally says that he knows the date and we’ve ruled out May, June, and the 14th’s, we know it has to be a month with only one date left, namely July 16. Since August still has two choices, the 15th and 17th, Albert wouldn’t have been certain that he knew the date if he had been told August. So Albert must have been told July. 

Final answer: July 16 is Cheryl’s birthday.