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 9, 2012 | Science Fiction | submitted by Alanowsky

Star Wars Episode V: The Empire Strikes Back

/*  Star Wars Episode V: The Empire Strikes Back - Funny Code */

var characters = ["Luke Skywalker", "Darth Vader"],
    sides = ["Light Side", "Dark Side"],
    lukeHasHand = true,
    lukeKnowsPowerOfDarkSide = false,
    lukeJoinedToHisFather = false,
    lukeKnowsTrueAboutHisFather = false,
    winner = '';

function saySomethingByCharacter(id, string) {
    if(!isNaN(id)) {
        document.write("" + characters[id] + " says: " + string + "
");
    } else {
        document.write("Character which ID: " + id + " doesn`t exist.
");
    }
}

function makeSituation(string) {
    document.write("** " + string + " **
");
}

function removeHand(a, b) {
    if(!isNaN(a && b)) {
        makeSituation(characters[a] + " cut off the hand of " + characters[b]);
        if(b == 0) lukeHasHand = false;
    } else {
        document.write("Character which ID: " + id + " doesn`t exist.
");
    }
}

function lukeEscapes() {
    makeSituation("Luke was to week to defeat Darth Vader, he escapes.");
    winner = sides[1];
}

removeHand(1, 0);
if(lukeHasHand == false) {
    saySomethingByCharacter(1, "There is no escape! Don't make me destroy you. Luke, you do not yet realize your importance. You've only begun to discover your power! Join me, and I will complete your training! With our combined strength, we can end this destructive conflict, and bring order to the galaxy.");
    if(lukeJoinedToHisFather == false) {
        saySomethingByCharacter(0, "I'll never join you!");
        saySomethingByCharacter(1, "If only you knew the power of the Dark Side. Obi-Wan never told you what happened to your father.");
        saySomethingByCharacter(0, "He told me enough! He told me you killed him!");
        if(lukeKnowsTrueAboutHisFather == false) {
            saySomethingByCharacter(1, "No, I am your father.");
            saySomethingByCharacter(0, "No. No! That's not true! That's impossible!");
            saySomethingByCharacter(1, "Search your feelings, you know it to be true!");
            saySomethingByCharacter(0, "NOOOOOOO! NOOOOOOOO!!!");
            saySomethingByCharacter(1, "Luke, you can destroy the Emperor. He has foreseen this. It is your destiny! Join me, and together, we can rule the galaxy as father and son! Come with me. It is the only way.");
            lukeKnowsTrueAboutHisFather = true;
        } else whoKnows();
    } else {
        lukeKnowsPowerOfDarkSide = true;
        winner = sides[1];
        makeSituation(characters[0] + " join to " + sides[1]);
        makeSituation(winner + " won.");
    }
} else lukeEscapes();
Vote up this code0

| Adventure | submitted by Ricardo Sabino

Back To The Future

#include
#include
 
int main()
{
  auto future = std::async([] { return "Future"; });
  std::cout << "Back To The " << future.get() << std::endl;
  return 0;
}
Vote up this code0

| Adventure | submitted by CD

Finding Nemo

vector::const_iterator findNemo(const vector& school)
{
   
    for(vector::const_iterator i=school.begin();i!=school.end();i++)
        if(i->name=="Nemo") return i;
    return school.end();
}
Vote up this code0

| Action | submitted by Nick Pyett

The Fifth Element

var elements = ['','Earth','Wind','Fire','Water','Hot alien chick'];

function defeatGaryOldman(){
    return elements[5] + ' + Bruce Willis';
}
Vote up this code0

| Science Fiction | submitted by rt of vnt

Clouse Encounters of the Third Kind


$aliens_spaceship_location='space';
$location ='Devil Tower';
$scientis_location ='Earth';
$aliens_melody = array(d, e, c, C, G);
$melody_send_to_space = array(d, e, c, C, G);

if ($aliens_melody == $melody_send_to_space) {
   
        $aliens_spaceship_location = $location;
       
            if ($aliens_spaceship_location =='Devil Tower') {
                    $scientis_location ='Space';
                }
        echo 'Scientists are in '.$scientis_location.' now';
}
?>
Vote up this code0

| Thriller | submitted by calvin

Perfect Blue

body { background-color: #0000ff }

Vote up this code0

| Fantasy | submitted by

The Neverending Story

public string Story()
{
    while (true)
    {
        read(book);
    }
    return "Moonchild";
}
Vote up this code0

| Action | submitted by Ray Brooks

Kill Bill

#!/bin/sh
for PROC in `ps x | grep bill | cut -d ' ' -f 1`
do
  kill -9 $PROC
done
Vote up this code0

| Science Fiction | submitted by Jeremy

War Games

using System;
using System.Text;
using WOPR;
using WOPR.Joshua;

namespace WarGames
{
    class BackDoor
    {
        public static BackDoor();
        {
            string userInput;

            Console.WriteLine("SHALL WE PLAY A GAME?")
            userInput = Console.ReadLine();

            if (userInput == "GLOBAL THERMONUCLEAR WAR")
            {
                WOPR.MissileLaunch();
            }
            else
            {
                WOPR.Chess();
            }
        }
       
    }
}
Vote up this code0

| Action | submitted by donald hutchison

On Her Majesty’s Secret Service

$("#007").on("her majesty's secret service", function (Lazenby) {
    Lazenby.style = null;
});
Vote up this code0