How To: View Golden Globe Nominee Inception Via Code

View Golden Globe Nominee Inception Via Code

How to View Golden Globe Nominee Inception Via CodeInception may not be the lead contender for the 68th Golden Globe Awards, honoring the best movies and television from 2010, but Christopher Nolan's film still collected four nominations— Best Motion Picture, Best Director, Best Screenplay and Best Original Score.

But does it stand a chance against films like The Social Network, The King's Speech, Black Swan and The Fighter?

Only if everyone knows what's going on.

Even programmers...

dhirschl over at RepeatGeek wrote an article called How To View Inception Through Code, which compares the film to coding, which seem to be remarkably similar.

Inception is now a powerhouse film in the Simulism genre of movies, right alongside films like Dark City, eXistenZ, The Thirteenth Floor and The Matrix Trilogy.

"Watching the film from the standpoint of a programmer, I could not help seeing the similarities between the plot devices and basic programming concepts," said dhirschl.  And now we all can see those similarities.  Maybe you don't even have to watch Inception before the Golden Globes kick off in January 2011— just read the code...

Step 1 The Kick

The Kick is the concept they use in the movie to return to a dream level above the existing one. For example, if you perceive that you are falling in a dream, you have a tendency to wake up.

The Kick can be portrayed in programming in several different ways:

Recursion

How to View Golden Globe Nominee Inception Via Code

* CheckForKick() implementation has been omitted.

In this recursion example, each call to function Dream() will call another sub-Dream – until the CheckForKick() function returns true, which can occur however many levels deep.

Exception Bubble

How to View Golden Globe Nominee Inception Via Code

In this Exception example, an exception is thrown within a nested try block. Rather than handling the exception at that level, it's bubbled up until is (hopefully) handled gracefully.

Stack

This can best be represented by the following infographic, which I reconstructed to be a stack. Here is the original source.

How to View Golden Globe Nominee Inception Via Code

A stack is one of the most fundamental data structures in computing. A stack operates in the following: items are added in a First-In, Last-Out (FIFO) manner. They are added via being "Pushed" onto the stack and removed via being "popped" from the Stack.

In the movie, each sub-dream is pushed onto the stack starting with reality. Our characters cannot return to a different dream level by popping the dream above off the stack.

Step 2 Sedation

They use Sedation in the movie to prevent the dreamers from waking up any means other than "falling" on all dream levels above the first. At the first dream level, the only way to wake up is for the machine's time to elapse.

Sedation in the movie can be explained through the use of Threading.

Click through for the rest (threading; infinite loop or infinite recursion) on RepeatGeek.

Just updated your iPhone? You'll find new Apple Intelligence capabilities, sudoku puzzles, Camera Control enhancements, volume control limits, layered Voice Memo recordings, and other useful features. Find out what's new and changed on your iPhone with the iOS 18.2 update.

1 Comment

There is a typo in step one of the stack, it says it uses FIFO, which is correct, but then explains that it is First-In, Last-Out (FIFO) manner. It Should be First-In, First-Out. Great Article.

Share Your Thoughts

  • Hot
  • Latest