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

April 4, 2012 | Science Fiction | submitted by Emanuele Granucci

The fifth element


function tfe($vect) {
   return $vect[4];
}
?>
Vote up this code1

| Science Fiction | submitted by Emanuele Granucci

Matrix

#define SIZE 4
int main(void) {
   int m[SIZE][SIZE];
   return 0;
}
Vote up this code2

| Science Fiction | submitted by Emanuele Granucci

Star Wars

include <stdio.h>
void against(char * s1, char * s2) {
   printf("%s winsn", s1);
}
int main(void) {
   against("Polaris", "Mizar");
   return 0;
}
Vote up this code1

| Action | submitted by Emanuele Granucci

Memento

int main(void) {
   int a[1];
   return a[1]; // out of memory...
}
Vote up this code0

| Adventure | submitted by Emanuele Granucci

Seven years in Tibet


for ($i=0, $year=2012; $i<7; ++$i) $Tibet[] = $year-$i;
?>
Vote up this code2

| Science Fiction | submitted by NightCreature

2001: A Space Odyssey

#include
#include

enum people
{
    eDave;
}

class HAL9000
{
public:
    HAL9000 () {}
    ~HAL9000() {}
   
    std::string askQuestion(people person)
    {
        if (person == people::eDave)
            return "I can't do that dave";
    }
}

int main()
{
    HAL9000 hal9000();
   
    std::cout << hal9000.askQuestion(people::eDave) << std::endl;
   
    return 0;
}
Vote up this code1

| Drama | submitted by fox

The Curious Case of Benjamin Button

{
    return 0;
    }
        age++;
    while (!dead()) {
    int age = 0;
int main() {
Vote up this code10

| Family | submitted by Alessandro Franceschi

Pinocchio

package { 'puppet':
  ensure => present,
}

service { 'puppet':
  ensure  => running,
  enable  => true,
  require => File['puppet.conf'],
}

package { 'puppetmaster':
  ensure => present,
}

file { 'puppet.conf':
  ensure  => present,
  path    => '/etc/puppet/puppet.conf',
  require => Package['puppetmaster'],
  content => template('puppet/puppet.conf.erb'),
}
Vote up this code0

| Thriller | submitted by James Birchfield

Memento

} otnemeM ssalc cilbup

    } (sgra ...gnirtS)niam diov citats cilbup  
        ;("!tegrof t'nod I os nwod sgniht etirW")nltnirp.tuo.metsyS    
    {  

{
Vote up this code9

| Action | submitted by Fabrizio

Inception

<script>
console.group("inception movie");
var inception = (function() {
   
    /* on flight: arianna's dream */

    var timerate = 1;
    var team = ["Yusuf", "Arthur", "Eames", "Saito", "Arianna", "Dominic", "Mr.Fischer"];
   
    console.log("Real world", team);
    console.log("Time Rate is ", timerate);
    console.log("1 second is %d second (what else?)", 1/timerate);

   
    (function(timerate) {
        /* Yusuf escape */
        console.group("1th level: arianna's dream");
        var kick = "fall in the water";

        console.log("1th level team", team);
        console.log("Time Rate is ", timerate);
        console.log("1 second is %d second, about %d minutes", 1/timerate, 1/timerate/60);

        (function(team, timerate) {
            /* Arthur hotel escape */
            console.group("2nd level: Hotel escape");
            var kick = "elevator wreck";
           
            console.log("2nd level team", team);
            console.log("Time Rate is ", timerate);
            console.log("1 second is %d second, about %d minutes", 1/timerate, 1/timerate/60);
           
            (function(team, timerate) {
                /* Mountain */
                console.group("3rd level: Mountain's fortress");
                var kick = "fortress destruction";
               
                console.log("3rd level team", team);
                console.log("Time Rate is ", timerate);
                console.log("1 second is %d second, about %d minutes", 1/timerate, 1/timerate/60);
       
               
                (function(team, timerate) {
                    console.group("4th level: the Limbo");
                    /* Limbo */
                    var kick = "skyscrapes collapse";
                   
                    console.log("Limbo team", team);
                    console.log("Time Rate is ", timerate);
                    console.log("1 second is %d second, about %d minutes or %d hours",
                                1/timerate, 1/timerate/60, 1/timerate/3600);
                   
                    console.groupEnd();
                   
                    return kick;
                })(team.slice(2), timerate/12); /* 4th level */
             
                console.groupEnd();
                return kick;
            })(team.slice(1), timerate/12); /* 3nd level */
           
            console.groupEnd();
            return kick;
        })(team.slice(1), timerate/12); /* 2nd level */
       
        console.groupEnd();
        return kick;
    })(timerate/12); /* 1st level */
   
   
})();

    /* now you think you have come back into reality...
* but what if you were into another closure? =)
* who knows?
*/


script>
Vote up this code2