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 | War | submitted by Howard

Immortals

function die(){
   return false;
}
Vote up this code7

| Fantasy | submitted by sirLisko

Game of Thrones

var today = new Date();
var winter = new Date("December 21" + today.getFullYear());
while (today++ < winter){
    winter_is_coming();
}
Vote up this code9

| Action | submitted by Howard

The Hunger Games

ArrayList<Tribute> tributes = new ArrayList<Tribute>(24);
for(District d : districts){
    tributes.add(d.getFemaleTribute());
    tributes.add(d.getMaleTribute());
}
while(tributes.size() > 2)
    tributes.remove((int)Math.floor( Math.random() * (tributes.size() - 2) ));
try{
    tributes.remove((int)Math.floor( Math.random() * 2 ));
    declareVictor(tributes.get(0));
}catch(DoubleSuicideException e){
    declareVictor(tributes.get(0));
    declareVictor(tributes.get(1));
}
Vote up this code5

| Action | submitted by Over1imit

Superman

class Clark Kent extends Superman
{

String disguise = "glasses";
boolean save_lois_lane = false;
boolean obvious_disguise = true;
int lois_common_sense_level = 10;

if (save_lois_lane == true)
{
--lois_common_sense_level;
obvious_disguse = false;
}
else
{
lois_common_sense_level--;
}

}
Vote up this code1

April 3, 2012 | Adventure | submitted by surf

127 hours

Console.WriteLine(string.Format("{0} hours", new TimeSpan(5, 7, 0, 0).TotalHours));
Vote up this code4

| Comedy | submitted by Meg

Twins



class Baby {
    private $height = 5.9;
   
    public function __construct() {
    }
   
    public function __toString() {
        return strval($this->height);
    }
   
    public function __clone() {
        // mutation!
        $this->height = 4.5;
    }
}

echo $Julius = new Baby();

echo $Vincent = clone $Julius;

?>
Vote up this code3

| Action | submitted by akoskaaa

Fight Club

#DEFINE RULE1 "You do not talk about FIGHT CLUB."
#DEFINE RULE2 "You DO NOT talk about FIGHT CLUB."
#DEFINE RULE3 "If someone says "stop" or goes limp, taps out the fight is over."
#DEFINE RULE4 "Only two guys to a fight."
#DEFINE RULE5 "One fight at a time."
#DEFINE RULE6 "No shirts, no shoes."
#DEFINE RULE7 "Fights will go on as long as they have to."
#DEFINE RULE8 "If this is your first night at FIGHT CLUB, you HAVE to fight."
Vote up this code7

| Comedy | submitted by Speedpickle

Knocked up

var protect:Boolean

if (protect == false && 8==D)
{
   knockedUp();
}
Vote up this code7

| Fantasy | submitted by Hapsnurker

Lord of the rings

public void LordOfTheRingsMarathon()
{
  for(int i=0; i<3; i++)
  {
    PlayMovie(i, true);
  }
}

private void PlayMovie(int movieNumber, bool extendedVersion)
{
   List chapters = GetChapters(movieNumber, extendedVersion);
   
   foreach(LotrChapter chapter in chapters)
   {
      if(chapter.title.contains("Frodo") || chapter.title.contains("Sam") || chapter.title.contains("Gollum") || chapter.title.contains("Treebeard") || chapter.title.contains("Hobbits"))
        chapter.FastForward();
      else
        chapter.Play();  
   }
}
Vote up this code4

| Science Fiction | submitted by

Moon

SamBell = (n) -> @iteration = n

currentEmployee = new SamBell 1

sendEmployeeHome = ->
    cloneNumber = currentEmployee.iteration + 1
    currentEmployee = null

    newEmployee = new SamBell cloneNumber
    newEmployee.memories = SamBell.prototype.memories
    currentEmployee = newEmployee

# 3 years
setInterval sendEmployeeHome, (1000 * 60 * 60 * 24 * 365 * 3)
Vote up this code0