Showing code in movies - a minor rant

I went to see the movie "Ex Machina" this past weekend. The plot involves a reclusive search-engine billionaire bringing one of his code drones up to his remote estate/research lab to administer the Turing Test to an Artificial Intelligence (called Ava) that is housed in a robotic body.

I've always been intrigued with AI and the film presents some interesting ideas about intelligence, free will, the roots of emotion, use of information, and what it means to be human. There were some superior special effects, especially with Ava's body. The only "human" parts of her are the face, hands, and feet. Ava's neck, torso, lower arms, and legs are transparent with the mechanics and structure visible beneath a mesh "skin." (Coincidently, I had watched the Star Trek episode "Requiem for Methuselah" the same morning, which has some similar themes.)

But I'm not writing this to comment on all the ideas, beautiful scenery, and twists in the movie.

I'm writing this to implore Hollywood and film and TV producers to be more careful when showing computer code that is vital to the plot. Being technically savvy can sometimes be a drag when trying to enjoy a few hours of escapism. When I see computers involved in a show, a little tiny bug starts murmuring in the back of my mind; when I see something egregiously wrong, I can be completely taken out of the plot.

[If you've not seen "Ex Machina" and are planning to do so, you may want to STOP reading now, book mark this page, and come back after you've seen the film.]

Without trying to reveal too much, when one character tries to infiltrate a building security system during "Ex Machina," code is written. No problem with that and if the camera had focused on the character's face everything would have been okay. Unfortunately, the director shows the screen (twice) and the programming that is being carried out. The first thing I noticed is that the code being typed into the console is written in Python. (Not too bad, but probably not my first choice to hack in to a security system.) The next thing I notice is that a comment had been typed into the code. (Who types comments into a one-time hack they're writing off the top of their head?) Then I notice that the comment is about finding primes with the Sieve of Eratosthenes. (What?!?) And the code is just that. During my computing career I've written this code/algorithm several times and with several different programming languages.

It sounds like a minor nit to pick, and someone that doesn't have a programming background might not even notice. However, at that point my mind was totally taken out of the movie and focused on how computing prime numbers could help overthrow the system security. Was the attack going to tie up resources (like Mr. Spock trying to compute the value of pi to the last digit in order to rid the USS Enterprise computer systems of the Redjac virus)? Or did the director just turn to the nearest intern that could program and ask them to type some code that they could film? Wouldn't some assembly language code be more appropriate and unfathomable by most everyone? Or even a shell script that accessed root files?

I'd like to offer my services to television and film production companies as a "code consultant" that can find something appropriate for them to use when they need to display computer programming within their productions. I may not have much experience, but I know I wouldn't show some COBOL code scrolling past the screen (because deadly robots from the future bent on destroying humanity wouldn't try to conquer us with a better payroll system). And don't get me started on chess board setups...

For more complete information about compiler optimizations, see our Optimization Notice.



Murray -

That's actually cool. Now I can't wait to see this at home and I can pause it on the DVR. I did enjoy the film nevertheless.

Leaving out the comment would have been a good idea. Without that it is just code that I might have recognized the language from the programming pattern. Even with the comment it isn't as bad a having icebergs trying to crush a submarine as it travels under the polar icecap (ice floats).

Murray S.'s picture

FYI it's actually an Easter egg. What the code really does is index into the list of primes, then adds various offsets to get a series of numbers. This is the ASCII for the ISBN of my book "Embodiment and the Inner Life", which it then prints out. The book was a major influence on Alex Garland when he was writing the script:

I probably should have omitted the comment about the sieve of Eratosthenes. But I hope you enjoyed the rest of the film.

Sharon G. (Intel)'s picture

I  hear you. Those errors are not good film making.

The only film I have ever walked out on was when a quick 2 minute scene had a completely incorrect chess position on the board paired with the actual actor dialogue. (It hadn't been a good film anyways up to that point - but that was the last straw.)

Add a Comment

Have a technical question? Visit our forums. Have site or software product issues? Contact support.