Hacker News new | comments | show | ask | jobs | submit login
Source Code in TV and Films (moviecode.tumblr.com)
118 points by ColinWright 1376 days ago | hide | past | web | 34 comments | favorite



This was from the best episode of that entire series in a rare instance of the writers not trying to shoehorn a helicopter dogfight into an otherwise mundane domestic misadventure (assuming you're willing to accept that a helicopter can fly above the atmosphere and attempt to start WWIII of course).


Didn’t the same thing happen in Superman III? I seem to recall a computer display is shown with various advanced-looking outputs and then they also run a LIST command, which lists a BASIC (or maybe COMAL) program written to… display various advanced-looking outputs. Using the PRINT statement. Followed by many individual lines of PRINT "" to make the screen clear.


Iron Man (2008) shows that Iron Man boots with the Mozilla JavaScript documentation. It seems to favor RegExp. Maybe that was shoddy movie research, maybe we should be glad that Iron Man does not run on W3Schools tutorials, maybe Jeff Atwood is right when he said: any application that can be written in JavaScript, will eventually be written in JavaScript.


The butchered Iron Man suit built in a cave boots with a Lego Mindstorms RCX IR firmware uploader: http://deeperdesign.wordpress.com/2010/02/26/is-iron-man-mad...



This made me remember the code from Vivek Ramachandran being used in the movie White House Down and him writing a blog post about it including the quirks in the code[0]

[0]: http://hackoftheday.securitytube.net/2013/04/my-code-made-it...


My favorite example is from Terminator, blogged about here (not by me):

http://www.pagetable.com/?p=64

When I first saw the movie I was with a friend who laughed out loud at that point and said "hey, that's 6502 assembler".

I guess "I know UNIX" from Jurassic Park doesn't count.


This compendium of source code as decoration is somewhat addictive. Thank you?


Very cool insights.

An aside, I wish Airwolf was as amazing a TV show at age 26 as it was when I was age 9.


In case anyone is feeling nostalgic, almost all of the episodes are available for free streaming on IMDb, including this one s2e3 "Moffett's Ghost"

http://www.imdb.com/title/tt0086662/episodes?season=2


When I was a kid, I wanted hair like Stringfellow Hawke so bad. I don't feel the same way now after reading this and learning he can't read hex :(


The overzealous headline-fixer strikes again. I can't remember what it was this morning, but it was better than this. The name of the blog an article is posted on is not an accurate or useful headline when the link only references a single article on that blog.


Original title was:

    Source Code in TV and Films: There's
    a bug in AirWolf's code ...
As you say, better than the generic title now.

I can understand why the moderators change a lot of the titles, I really can. And I can understand that it's potentially too time consuming to vet every single title that gets submitted, and hence it kind of needs to be automatic. But I really can't help thinking that on a forum called "Hacker News" there would be some kind of hack that says: Hang on, this is clearly adding something to the original title - maybe it's reasonable to allow that.


FYI this tumblr is run by HN's own John Graham-Cumming (jgrahamc). Previous discussion: https://news.ycombinator.com/item?id=7006317


The programmer should have traveled in time to read this: http://msdn.microsoft.com/en-us/library/ms233801.aspx


Why? They are getting the indexing right. What's wrong is generating a random number from 1 to 16 inclusive. They use RND(1) to generate a random float from 0 to 1, including 0, not including 1. They multiply by 15 (that's the mistake) to get a random float from 0 to 15, not including 15. They use INT to round down to get an INT from 0 to 14 inclusive, then add 1.

That gives them an INT from 1 to 15 (inclusive) to access the list of digits.

The mistake is they want an INT from 1 to 16, so they should have multiplied by 16.

Your link is to a page that talks about the difference between MID, which indexes from 1, and substring, which indexes from 0. Indexing from 1 is not the error, so I don't see why your link is relevant.


Pair-programming at its finest: http://www.youtube.com/watch?v=u8qgehH3kEQ


The show Revolution uses source code from some open source computer vision projects and Prince of Persia if I remember correctly.


Another interesting trivia would be to figure out what actors are typing when they type on keyboards vs what we see on screen.


-1 for disabling pinchzoom on mobile devices. Why disable useful functionality?


Any guesses as to what the subroutine on line 1000 does?


I think it might have to do with formatting the displayed output. There are nine columns in the display and the loop at line 45 puts nine values into L$. But why the GOSUB only occurs when I is 9 or 16 isn't clear.


Actually it is an old school delay loop -- it runs an empty loop from 1 to 200, which on the old computers would take some significant fraction of a second. This adds a slight delay after printing each line. Proper programming would call a sleep or usleep function, of course.


Oh, when I looked at this earlier, the second page of code wasn't there, so we had to guess what line 1000 looked like. I see the page has been updated (or my browser got its act together).


Plays the theme music?


He is not right either... 15 is 0xF. 16 is 0x10.


He is correct, that the value 16 given to MID$ as a 'start' will yield an "F" because the 'start' argument to the MID$ function is one-based.

This is the string:

     A$ = "0123456789ABCDEF"
And calling the function will give you: MID$ (A$,1,1) => "0" ... MID$ (A$,15,1) => "E" MID$ (A$,16,1) => "F"

MID$ (


Ah, thanks! I was scratching my head on that one...


Right, the reason it won't ever emit F is because RND(1) will never return 1, it's implementation will return 0<=X<1, and INT() is a truncation, so INT(RND(1) + 15) will return an integer between 0 and 14. Adding one gives 1 to 15, and since F is in the 16th position of the string (Apple BASIC indexed from 1, not 0) it will never get selected.


INT(RND(1)+15) will always return 15 and nothing else, since the expected output would be a rounded-down integer value of (a random number between 0 and 0.99999999etc999, plus 15).

INT(RND(1) * 15), in contrast will produce a random whole number from 0 to 14. Hence the popular use of, for example, INT(RND(1) * 6)+1 in any given situation where a random number between 1 and 6 is required.


Correct... my mistake, I put "+" when the original code was "*".


But they're using MID to extract a character from the string. Seems to me that string indexes are 1-based in Apple BASIC as evidenced by the " ... + 1" and the fact that there are 0's on the page. So you select from characters 1 to 16 in the string.

Edit: seems I was slower than all the other replies...


Assuming of course the programmer wanted to output an F.


Since A$ contains an F, it seems like a reasonable assumption that it was expected in the output.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: