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 31, 2012 | Action | submitted by Berumen

Inception

 
class Dream
{
    const DREAM_LEVEL = 1;
    public function goToSleep() {
        try {
            $this->goDeeper( self::DREAM_LEVEL );
        } catch (MyException $e) {
            throw new Exception("You're actually in the middle of the workshop right now, sleeping");
        }
    }
    protected function goDeeper($dreamLevel) {
        try{
            $dreamLevel+=1;
            $this->goDeeper($dreamLevel);
        } catch (MyException $e) {
            throw new Exception('Your world is not real!');
        }
    }
}
$alfredo = new Dream;
try{
    $alfredo->goToSleep();
} catch (Inception $kick) {
    echo 'Think about it '.$kick->getName().', how did you get here?';
}
?>
Vote up this code13

March 30, 2012 | Comedy | submitted by Balazs

Monty Python’s The quest for the Holy Grail

King Arthur = new King();
Knight Bedevere = new Knight();
Knight Robin = new Knight();
Knight Lancelot = new Knight();
Knight Galahad = new Knight();
QuestItem HolyGrail = new QuestItem();

public void init(){
     Arthur.set3(5);
     Robin.setBraveness(0.0);
     Lancelot.setBraveness(Float.POSITIVE_INFINITY);
     Galahad.setPurity(Float.POSITIVE_INFINITY);
     Bedevere.setIQ(200.0);
     HolyGrail.setLocation("French castle");
}

public void BringOutDeads(){
     Villager Mortician = new Villager();
     Villager Customer = new Villager();
     Villager DeadMan = new Villager();
     Customer.setParent(DeadMan);
     for(int i = 0; i < 10; i++){
          getLogger.out("Bring out your dead!", Mortician);
     }
     Mortician.setCustomer(Customer);
     if(!DeadMan.isDead()){
          Mortician.setRefuseService(true);
          getLogger.out("I am not dead!nI feel happy.", DeadMan);          
     }
     DeadMan.setUncosious(true);
     Mortician.setRefuseService(false);
}

public void BlackKnight(){
     Knight BlackKnight = new Knight();
     BlackKnight.setSelfConfidence(Float.POSITIVE_INFINITY);
     BlackKnight.setEnemy(Arthur);
     BlackKnight.setHand(BlackKnight.getHand()-1);
     BlackKnight.setHand(BlackKnight.getHand()-1);
     BlackKnight.setLeg(BlackKnight.getLeg()-1);
     BlackKnight.setLeg(BlackKnight.getLeg()-1);
}

@Depricated
public boolean isWitch(Woman woman){
     boolean result = true;
     if(checkAnyVillagersNewt() == false){
           if(woman.isFlammable() || (woman.getMaterial().equals("wood") && !woman.getMaterial().equals("stone"))){
                  if(woman.isFloatingOnWater()){
                         if(woman.getWeight()>=(new VerySmallRock()).getWeight()){
                              result = true;
                         } else if(woman.getWeight()>=(new Apple()).getWeight()){
                              result = true;
                         } else if(woman.getWeight()>=(new Mud()).getWeight()){
                              result = false;
                         } else if(woman.getWeight()>=(new Cherries()).getWeight()){
                              result = false || true;
                         } else if(woman.getWeight()>=(new Church()).getWeight()){
                              result = mainDecision.getRandomDecision();
                         } else if(woman.getWeight()>=(new Cider()).getWeight()){
                              result = true;
                         } else if(woman.getWeight()>=(new Bread()).getWeight()){
                              result = false;
                         }
                  }
           }
     } else {
           result = false;
     }
     return result;
}

public boolean isWitch2(Woman woman){
     return(woman.getWeight()>=(new Duck()).getWeight());
}
Vote up this code2

| Action | submitted by Balazs

Battle Royale

public static void main(String[] args){
        boolean isKitanoAlive = true;
        int japaneseKidCount = 33;
        while(japaneseKidCount>1 && isKitanoAlive){
                japaneseKidCount--;
                checkKitano();
        }
        System.out.println("The End");
}
Vote up this code4

| Action | submitted by Joske

Super 8

class movie extends Integer {
    Movie () {
        super("8");
    }
}
Vote up this code3

| Action | submitted by noxius

Prison Break

public class Show(){
    private int max = 5; // Seasons :1-4 + "The Final Break" = 5

    public void watchBoxSet(){
         for(int i=1; i <= max; i++){
               watch(i);  
         }
    }

    public void watch(int season){
          if(season%2!=0){
                break;
          }else{
                   run();        
           }
    }

    public static void main(String [] args){
                watchBoxSet();
    }
}
Vote up this code0

| Horror | submitted by Joske

Dexter

class Dexter {
    void run () {
        while(isAlive() && showCanceled == false ) {
            try {
                makeFriend()
            } catch (GoesCrayExption ie) {
                killFriend()
            }
        }
    }
}
Vote up this code3

| Action | submitted by Joske

Lord of the Rings Extended

class LordoftheRingsExtended extends LordoftheRings {
    LordoftheRingsExtended () {
        super();
        moreWalking();
    }
}
Vote up this code8

| Drama | submitted by Joske

Goodbye Lenin

Person alex;
Person mom;

if (lenin.isAlive()) {
    alex.work();
    alex.visit(mom);
} else {
    while (alex.manages) {
        alex.hideEndofEastGermanyFrom(mom);
    }
    if (alex.givesUp()) {
        alex.move(mom);    
    }
}
Vote up this code5

| Comedy | submitted by Joske

Catch me if you can

Vote up this code6

| Drama | submitted by Joske

The Fountain

class LoveStory {
        public int yearHappening = 2006;
        public ArrayList scenes={"Find Tree", "Ethernal Live", "die"};
 
        void addScene( int i, String scene) {
                scenes.add(0, scene);
        }
        void removeScene( int i) {
                scenes.remove(0);
        }
}

class Movie {
        static void playMovie () {
                LoveStory present = new LoveStory();
                LoveStory past = new LoveStory();
                past.yearHappening -= 500;
                past.addScene(0, "Meet Queen");
                past.addScene(1, "Accept Quest");
                LoveStory future= new LoveStory();
                past.yearHappening += 500;
                past.remove(0);
                past.addScene(1, "Talk to Three");
                past.addScene(1, "Talk to Three");
                past.addScene(1, "Talk to Three");

                int i = 0;
               
                while (i <  present.scenes.lenght() || i <  past.scenes.lenght() || i <  past.scenes.lenght() ) {
                       
                        if ( present.scenes.lenght() > i ) System.out.println( present.scenes.get(i);

                        if ( present.scenes.lenght() > i ) System.out.println( present.scenes.get(i);

                        if ( present.scenes.lenght() > i ) System.out.println( present.scenes.get(i);

                }
        }
}

Movie.play();
Vote up this code0