
Inception movie explained programmatically with C and assembly - geospeck
https://github.com/karthick18/inception
======
phlillip
This reminds me of an awesome site my friend Ben Howdle built called
moviesascode. Users would contribute tiny code snippets that summarised a
whole movie. As an example:

.titanic{ float:none; }

Unfortunately he lost the site when he switched hosts, I've been badgering him
for years to restart it.

~~~
ctdonath
[https://web.archive.org/web/20130614010033/http://moviesasco...](https://web.archive.org/web/20130614010033/http://moviesascode.net/)

~~~
justinfaulkner
Thanks for the link. Some of those are really great.

Here's the original titanic/float one:
[https://web.archive.org/web/20120315194303/http://moviesasco...](https://web.archive.org/web/20120315194303/http://moviesascode.net:80/disaster/titanic/)

------
teekert
Hmm, I agree with Rick on this one:

    
    
        Rick: Boy, you're really gonna flip your lid over this one.
        Morty: Oh, w-wh... what is it?
        Rick: It's a device, Morty, that when you put it in your ear, you can enter people's dreams, Morty. It's just like that movie you keep crowing about!
        Morty: You're talking about Inception?
        Rick: That's right, Morty! This is gonna be a lot like that, except y'know, it's gonna me-beh... make sense.
        Morty: Inception made sense!
        Rick: You don't have to try and impress me, Morty! 
    

and

    
    
        Rick: "It's been six hours. Dreams move one one-hundredth the speed of reality, and dog time is one-seventh human time. So, you know, every day here is like a minute. It's like Inception, Morty, so if it's confusing and stupid, then so is everyone's favorite movie."
    

I still bugs me that they float in one layer because the fall in another (or
the other way around) then one layer deeper this is not a problem at all. It
seems so arbitrary. Like they based in on a novel but ignored all the parts
where they actually put in an effort to help you suspend your disbelieve.

------
vbuwivbiu
While we're here, can someone explain how a "dream within a dream" works in
Inception ? Presumably someone has to "fall asleep" inside their (or someone
else's) dream and go into a dream state again on another level so to speak.
The only way I can see the brain implementing that is to dream of its own
state so completely that it can run itself as a virtual machine, and fall
asleep inside that VM. I haven't read the code, but I doubt the C
implementation includes a VM that can run inside itself, Smalltalk-style.

~~~
techmagus
> While we're here, can someone explain how a "dream within a dream" works in
> Inception ?

Exactly like that. It happens in real-life and no doubt that's where they
based it from. It happened to me a couple of times already, the deepest I got
was 4 levels.

Real-life sleeping > level 1: sleeping > Level 2: sleeping > Level 3: sleeping
> level 4: awake

Usually, it was very bad. A form of nightmare. You slowly get aware of it,
even to the point that your brain tells you that you are awake. Then when
something happens that you want to wake up (for example, you died, or you
suddenly got aware you're sleeping), you will indeed wake up, up to the next
level.

Once again, your brain will tell you that you are finally awake.

The first experience I had of this was when I was barely a teenager. It was a
nightmare within a nightmare within a nightmare within a nightmare. When I got
fully aware I was sleeping, that's when I fought, waking up, then waking up,
then waking up, then finally waking up to the real world.

Problem was, I was no longer sure if it was the real world I woke up to. To
this day, I sometimes think I am still sleeping.

Just like the other ending in Inception. Hence I love that movie. I can
relate.

~~~
brianberns
> To this day, I sometimes think I am still sleeping.

This is a well-known problem in the lucid dreaming community. There are some
surprisingly easy ways to check. I find the simplest is to count my fingers
out loud. If there are definitely five on each hand, then I'm awake. If
there's any problem coming up with a count, then I'm asleep, no matter how
much it seems like I'm awake.

~~~
rebuilder
Unless that's just a feature of the deeper dream levels, not this one...

(I also have dreams where I wake up over and over and over, only to realize
that shit, I'm still dreaming. It's surprisingly disconcerting, there's a kind
of physical sense of losing my mind involved.)

~~~
dreamerdoob
Honestly you could just lack the awareness to notice. That's not a slight
against you, acute awareness in the dream state is not an innate ability and
must be practiced frequently in order to be successful with it.

In any dream state, you can test the rules of the world around you and see
that your brain doesn't quite build the world to completeness. Light switches
will not work, text will morph and shift either in front of your eyes or when
you look away and turn back, the people around you will spontaneously morph
into others, you can breathe through your nose when it's plugged, etc.

What happened to you is referred to as a false awakening. Testing the reality
of your situation by checking clocks, breathing through your nose, counting
your fingers, etc. will all quickly put you into a more lucid and aware state.
From there you either continue or, more commonly, you wake up.

~~~
techmagus
> Testing the reality of your situation by checking clocks, breathing through
> your nose, counting your fingers, etc. will all quickly put you into a more
> lucid and aware state.

I haven't thought of that. What became my anchor for the past few years have
been my schedule or being aware of it.

But there were rare cases when in my dream state, the reality is happening in
the dream and that totally puts me off greatly. A good example is when I'm
dreaming I woke up, went to work, and got home.

When I woke up, I didn't know until I arrived at the office and learned no day
has passed yet.

------
agentgt
I briefly glanced at the code and was expecting a game like clock to emulate
the time dilation that the dream within a dream caused.

I can't remember in the movie what was the deepest dream possible but you
could pick a large base ticker value in case whatever you decide as the lowest
dream is not (I remember the movie leaving that as an open question).

------
Cheyana
Great. Now do Memento.

~~~
MarcScott
Or Primer.

~~~
zentiggr
timestamp = now

while (true); if ( now - timestamp > rand() ) now = now - rand();

------
spadros
Now, if only it were actually readable...

~~~
sigjuice
What would your suggestions be to make this readable?

~~~
bigdubs
Less of it.

------
mschuster91
Hmm, something's broken on x64 OS X (10.11), in the last line:

> [Fischer] exiting back to reality from level [1] with the THOUGHT:

> Illegal instruction: 4

~~~
dhritzkiv
To fix this, I changed L14 of the Make file from

    
    
      ARCH_FLAGS := -m64
    

to

    
    
      ARCH_FLAGS := -m32

------
arjo1
Our CS1010 teacher in college used to test us on movies. I believe one year he
had done inception. Other years he did transformers, Star Wars etc.

------
callesgg
What is the point? Is it indented as Art? Was it made simply for the fun of
coding?

~~~
vbuwivbiu
what's the point of your comment ? is it intended as art ? was it made simply
for the fun of commenting ?

~~~
callesgg
The point of my question was/is to learn about opinions/thoughts from other
people who has a perspective that is different from my own.

------
danwroy
Why not lisp

------
kbenson
I can only assume C was used on purpose in tribute to how complex and
complicated the original movie was.

~~~
Hasknewbie
Not trying to be snarky, but what's complex about Inception? Once you're past
the two premises (you can infiltrate dreams; you can dream recursively) this
is just a heist movie without any significant plot twist, by which I mean
there is no world-changing or premise-questioning event, and only one apect of
said premises (the altered length of "lived time") is explored.

To use other Nolan movies as a point of comparison, Memento and The Prestige
are much more accomplished in terms of fully exploiting their concepts. And
within the domain of movies exploring the theme of "your lived experience is a
dream/illusion", there are much more effective and/or complex examples[1].

I have a feeling that Inception is kind of like Interstellar in terms of
public perception: people are psyched by the initial concept, so they don't
pay attention to the fact that its underlying narrative structure is pretty
run-of-the-mill.

I guess I sound like a buzzkill! If I've missed any deep concept within
Inception, I'd be glad to be schooled/enlightened, since I like understanding
what makes a movie tick. Also, I don't think it's a bad movie at all, just
that it's not that complicated once we're past the initial disorientation.

[1] Before anybody asks, in no particular orders: In The Mouth Of Madness,
Mulholland Drive, Paprika, Written By. In a different vein: Eternal Sunshine
of the Spotless Mind. Hell, even Total Recall (1990 version) and The Matrix
probably apply.

~~~
kbenson
> Not trying to be snarky, but what's complex about Inception?

Having to constantly track how many levels deep you are, how time flows at
that level, the rules for what may/may not wake you out of a level, the
specific actions going on during the specific levels at those rates of time,
how they interact all together, and whether you were right about the level the
movie took place at the entire time and what that means for it all, and the
information you've learned and leaned on to make the assumptions you have at
every point.

It's a very complex, complicated movie built out of very simple premises.

> I have a feeling that Inception is kind of like Interstellar in terms of
> public perception

Possibly. I wasn't super impressed by Interstellar, but not for the same
reasons people around me always seemed to point out. To me it felt like a
story that might have wanted to make some interesting philosophical points but
decided to hide them almost completely behind staid and rote characters and
plot and _overly_ interpersonal emotion driven motivations, given the scope of
the project they were supposed to be involved in.

> If I've missed any deep concept within Inception

I don't think so, I think you just misinterpreted what I meant by complicated.
It's not conceptually or philosophically complicated, it's _mechanically_
complicated. In the same way that two separate expressions of an algorithm or
procedure may be simple or complicated, elegant or a bunch of spaghetti code.
Inception is a simple set of concepts expressed as spaghetti code, but done so
purposefully with the intent to entertain.

~~~
jancsika
> Having to constantly track how many levels deep you are, how time flows at
> that level, the rules for what may/may not wake you out of a level, the
> specific actions going on during the specific levels at those rates of time,
> how they interact all together, and whether you were right about the level
> the movie took place at the entire time and what that means for it all, and
> the information you've learned and leaned on to make the assumptions you
> have at every point.

The cool thing about the movie is that you can misunderstand nearly all of
that, and when the music begins playing across all three (four?) dreams you
immediately grasp the consequence for the plot.

It's like not caring about Gnu make's console diarrhea flashing past the
screen, until the final message tells you a test failed and suddenly going,
"Oh, shit."

------
tribby
(2011)

------
qubex
Awesome.

------
minademian
so novel and simple!

------
msla
Why is C in quotes?

Better question: Why _isn 't_ assembly in quotes?

~~~
sctb
Not sure, we've removed the quotation marks. (Apologies to Chesteron.)

~~~
msla
I guess I'll have to resign myself to not knowing why some people program in
"C" as opposed to C or JAVA as opposed to Java.

Some people always write their surname in ALL-CAPS, too, and I never
understood that, either.

But it isn't so much that I don't understand. I don't understand a lot of
things. It's that _nobody else_ seems to understand, either. Even the ones who
do it. Or they've all taken a vow to keep this information from the rest of
us.

~~~
brianberns
Easy there, pal. I think people write "C" because the letter C alone looks odd
in a plain English sentence.

~~~
msla
That doesn't fully explain what I've observed, and your condescension is not
appreciated.

