Movies as code - Free your coding mind...

"Unfortunately, no one can be told what the Matrix is. You have to see it for yourself."

Morpheus, The Matrix

March 10, 2012 | Action | submitted by David Amador

Inception

int dream_level = 1;

void   go_to_sleep(int dream_level)
{
       dream_level+=1;
       go_to_sleep(dream_level);      
}

int main()
{
     try
     {
             go_to_sleep(dream_level);
     }
     catch(...)
     {
           print("Where am I?");
     }

}
Vote up this code0

| Fantasy | submitted by David Amador

Lord of the Rings Trilogy

int main
{
       if(giant_eagle_available())
       {
               fly_to_mordor();
               drop_ring();
               return credits();
       }
       else
       {
              while(arrived_to_mordor()==false)
              {
                    Entity::Frodo.isVisible = !Entity::Frodo.isVisible;
                    Entity::Frodo.Kindness-=1;
                    Entity::Sam.Patience-=1;
              }

             Entity::Frodo.NumberOfFingers-=1;

             drop_ring();
             return credits();
       }
}
Vote up this code0

| Action | submitted by Rich Gubby

Apocalypse Now

$(document).ready(function() {
    $('#apocalypse').now();
});
Vote up this code0

| Action | submitted by Rich Gubby

The Great Escape


$tunnelCompletion = 0;

while($tunnelCompletion < 100) {
    $tunnelCompletion++;
}
exit;
?>
Vote up this code0

| Science Fiction | submitted by Ricardo Sabino

Jumper

void Jump()
{
    if(Seen("place"))
        goto place;

    return;

    place: ;
}
Vote up this code0

| Action | submitted by Rich Gubby

Last of the Mohicans

$(document).ready(function() {
    $('.mohicans').last().find('.hurons').each(function(){
        $(this).remove();
    });
});
Vote up this code0

| Drama | submitted by Rich Gubby

Catch Me If You Can


try{
    echo 'Start con career';
    while(1) {
        attemptCon();
    }
} catch(Exception $e) {
    echo $e->getMessage();
    echo 'Work for FBI';
}

function attemptCon() {
    $cons = array(
        'Confidence trick',
        'Check fraud',
        'Imposter',
        'Escape'
    );
    if(rand(0,100) > 75) {
        throw new Exception('Arrest Frank Abagnale');
    } else {
        echo $cons[rand(0, (count($cons) - 1))].' con successful!';
    }
}
?>
Vote up this code0

| Drama | submitted by MaSTeR

Falling Down

// Falling_Down.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include
#include
#include

using namespace std;

enum friendship
{
    ENEMY,
    NEUTRAL,
    WIFE,
    DETECTIVE,
    FRIEND,
    DAUGHTER,
};
void WalkToDaughter(void);
int GetTarget(void);
void Kill(int Target);
void CheckFriendship(int Target);

void WalkToDaughter(void)
{
cout<<"Walking... n";
int tar = GetTarget();
CheckFriendship(tar);
}

int GetTarget(void)
{
    return rand() % 5;
}
void Kill(int Target)
{
    cout<<"Killed human. n";
}
void BeHappy(void);
void BeHappy(void)
{
    cout<<"I am happy n";
}
void CheckFriendship(int Target)
{
    switch (Target)
    {
    case 0:
    Kill(Target);
    WalkToDaughter();
    break;
    case 1:
    WalkToDaughter();
    break;
    case 2:
    WalkToDaughter();
    break;
    case 3:
    cout << "Died! n";
    break;
    case 4:
    WalkToDaughter();
    break;
    case 5:
    BeHappy();
    break;
    }
}

int _tmain(int argc, _TCHAR* argv[])
{
    WalkToDaughter();
    _getch();
    return 0;
}
Vote up this code0

| Crime | submitted by Manul4eg

Trainspotting

 using;
Vote up this code1

| Romance | submitted by Xeo

The Bold and The Beautiful

class TheBoldAndTheBeautiful
{
    static int episodes = 0;

    static void NextEpisode()
    {
        episodes++;
        PlayIntro();
    }

    static void Main(string[] args)
    {
        ForresterFamily forresters = new ForresterFamily();

        forresters.GetPerson("Ridge").SetAttribute("immortal", true);

        while (true)
        {
            NextEpisode();
            foreach (Person person1 in forresters)
            {
                if (person1.IsDead)
                {
                    person1.Ressurect();
                    NextEpisode();
                }
                foreach (Person person2 in forresters)
                    if (person1 == person2)
                        continue;
                    else
                    {
                        person1.DoSex(person2);
                        if (person1.IsMarried(person2))
                            person1.GetDivorce(person2);
                        else
                            person2.Marry(person2);
                        NextEpisode();
                    }
            }
            NextEpisode();
        }
    }
}
Vote up this code0