Entries Tagged 'code' ↓

Looking for Tuesday Night Football

The first non-trivial source code I ever read was a Basic listing of an Apple II game called Tuesday Night Football. TNF pitted you against a computer coach in a strategic, text-based duel of American football play calling. We huddled around the green Apple II CRT, trying to outwit the wily computer coach. We became convinced it cheated. We set out to rectify the situation, and the source code was the key.

A Brief History of Being Cheated at Football and Other Games of Chance

The first football game I ever owned was Mattel’s Talking Football. Not the later “Monday Night Talking Football”. Just plain old Talking Football. You got a big box, a cardboard field, a little record player that looked like a red cassette player, and the gramophonic intonations of Dick Enberg calling the plays. The box became the stadium no detail was spared. The game even came with a plastic yellow coin for the opening coin toss.

The Talking Football Box

The offensive coach picked the play, for example “Short Pass”, or my personal favorite, the high-risk, high-reward “Gadget” play, inserted the disk into the red “sportscaster”, and the defensive player looked at the back of the disk and rotated it until the specific defensive alignment was chosen, for example, “Prevent Defense”. Then you’d flip the switch to start the record player and lister the result: “Pass over the middle…intercepted!…he’s going to go all the way…TOUCHDOWN!” Or one I can still remember today with its pregnant pause and sudden reversal “Prevent defense, three man rush, trap up the middle for ten…uh oh…penalty.”

The Talking Football Sportscaster

There were about 70 combinations of plays and defenses, and one Christmas my older brother, then in grad school as a T.A for stats courses, calculated the expected value of each defensive and offensive play selection and routinely beat me. This was typical of the competitive torment I endured at the hands of someone with an understanding of probability and statistics which dwarfed my second grade math skills. Once he crushed me in Milton Bradley’s Game of Life by carefully observing the tendency of the spinning wheel’s non-random distribution. As he rolled up on the Day of Reckoning, he opted for the rarely used attempt at becoming a MILLIONAIRE TYCOON. From the instructions (warning: PDF):

Try to become a MILLIONAIRE TYCOON. If you have little or no money, place all that you have (your car if you’re broke) on ONE number on the number strip. Spin again. If you’re sic number comes up, you have become a MILLIONAIRE TYCOON, the WINNER and the game is over. If you lose, the bank takes your money, and you sit out the rest of the game at BANKUPT.

So he lays it all down on #3, spins and bam, 3 comes up and the frustrating hour of spinning and trying to stuff little pink and blue pegs into those cars goes down the drain. The one in ten chance might as well have been a one in a million chance. That’s still as close to a lottery winner as I’ve ever been.

Subprime crisis, Milton Bradley style. One minute you’ve got a car, six kids stacked up in the back and not a dime to your name, and the next minute you’re a winner.

Fixing What Ailed Us

Fast forward about eight or nine years and I come across the listing for Tuesday Night Football from a copy that a friend apparently cracked. Our relationship with the game was love/hate all the way: because while it made for an entertaining and addictive game, some bug in the code caused way too many fumbles to occur for our tastes. If I recall correctly, each play had about a 5% probability of a fumble; and either a logic bug or a problem with the pseudorandom number generator caused every fumble to be lost by the human coach, while the computer only occasionally lost a fumble. This was an easy fix to make, but what was notable was that in just a few pages of code, a plausible football game could be created. I remember seeing the listing on green and white fanfold paper and thinking, I could do that. When I later got my own Apple IIc, I modified the code to create a more balanced game. And by more balanced, I mean one that probably tilted more in my favor.

Searching for Tuesday Night Football

I set out last night to see if I could find the source code for Tuesday Night Football to confirm whether my recollections were accurate. Were we just complainers who couldn’t handle getting beat fair and square? Or were we right, that the fumble issue was a bug and not a feature? Although I found a disk image that I believe contains the program, and a host of Apple II emulators that might actually run it, I haven’t been able to locate the actual TNF source or even get the original game to run successfully in an emulator.

So Dear Lazyweb, if you’re out there, and you’re an Apple II fanatic who has the Basic source code for Tuesday Night Football, I would love to get a look at it again for research purposes.

update… More digging led me to the author of the original Tuesday Night Football, Charlie Anderson, and some artifacts related to the original version. It appears that after a brief life being sold through Apple dealers with mimeographed manuals and a disk stuffed in a plastic bag, Mr. Anderson was offered the sum of $1000 against 10% net royalties to assign the copyright of the game to Automated Simulations, Inc., which rechristened it as Tuesday Morning Quarterback. What are the chances that the source survives?

E.M. Forster and Agile Programming

From E.M. Forster’s Aspects of the Novel:

Another distinguished critic has agreed with Gide — that old lady in the anecdote who was accused by her nieces of being illogical. For some time she could not be brought to understand what logic was, and when she grasped its true nature she was not so much angry as contemptuous. ‘Logic! Good gracious! What rubbish!’ she exclaimed. ‘How can I tell what I think till I see what I say?’ Her nieces, educated young women, thought she was passée; she was really more up to date than they were.

And Giles Bowkett’s Let the System Design Itself

And it literally happens like that. If you’re building design-first, you’re saying, “The system will do XYZ - I’ll put that here.” But just because you know it’ll do XYZ, you don’t necessarily know how or where, and deciding ahead of time imposes an arbitrary and unnecessary structure on your code. So then you have a file called XyzFile, which is supposed to do XYZ, and then you have other code elsewhere in the system which actually does XYZ, and it’s in some other file, because the design you imagined will always be different from the design which emerges. It’s like coding in Java. There’s the structure of your actual program, and the structure that Java requires you to accommodate. That second structure is just unnecessary mental overhead, and the bigger your system gets, the more wasteful that overhead is. You’ll have a structure that emerges naturally, whether you want to or not. It’s as inevitable as gravity. You might as well just let the macro follow the micro, like it’s supposed to, and get the good design which emerges naturally as a byproduct of that process.

Forster uses the anecdote to point out how the meaning of the work emerges from the act of writing, much in the same way that Bowkett illustrates how good design, if good design exists at all, naturally emerges from the act of writing the code.

And perhaps in this connection exists a new mantra for agile programming: how can we know the software’s design until we see how it’s coded?

By the Numbers: The del.icio.us/popular/toread Count

As previously discussed, many of the popular links on del.icio.us tagged toread contained numbers in the titles. Now this can be quantified:

del.icio.us Sparkline

The sparkline above (courtesy Joe Gregorio’s sparklines service) shows the trend of the sum of numbers found in the titles of links in the del.icio.us/popular/toread feed over the last 14 days. (From what I can tell, the popular lists are recalculated about every 4 hours, so each bar represents one sample from each four hour period.) The sum is calculated by a Ruby script that periodically grabs the RSS feed for the popular/toread tag, taking any representation of a number from a title in the feed (e.g.,10, Ten, 101, 2001) and adding it to the total.

The numbers for the last two weeks:

Min: 89.5
Max: 2324.5
Mean: 697.47
Mode: 380
Median: 379

Coming soon…a way you can make a game out of this.