How to View Golden Globe Nominee Inception Via Code
Inception 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.
Only if everyone knows what's going on.
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:
* 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.
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.
This can best be represented by the following infographic, which I reconstructed to be a stack. Here is the original source.
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.