A lot of coding that happens on TV is complete and utter malarky. Look no further than the classic (and self-aware) double keyboard scene from NCIS. But that doesn't mean it's all bunk. In fact, as YouTuber Behind the Screens points out, code shown in an episode of the 1980s TV show Airwolf is completely functional, in fact it even has its own bug.

The episode's story pits a computer programmer against her late colleague's code, leaving her in a race to disable a 'logic bomb' her cohort had programmed to be activated by a dead man's switch upon his demise. The code show on the screen, did not have anything to do with a helicopter autopilot, as the show indicated. Instead, it's something even greater: half of the code is a random output of hexadecimal numbers, the other half is the code that generates it:

youtubeView full post on Youtube

Programmed in BASIC on an Apple II, this would have been high-tech and up to date at the time, but now it's an amusing quirk of time gone by, complete with some fun programming artifacts. For example, the code contains a loop that instructs the computer to just count from 1 to 200 every now and then—an action that would take a split second nowadays, but served to create seconds-long delays at the time, pauses designed to look like loading times.

Last but not least, as Behind the Screens points out, the code contains a minor error. It sets up a list of 16 characters to choose from (the hexidecimal numbers 0-9 and A-F), but only ever chooses from the first 15. With just a few keystrokes, bam, the problem is fixed. Just a few decades after the fact.

Source: Behind the Screens via Hacker News