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("<b>" + characters[id] + " says:</b> " + string + "<br />");
    } else {
        document.write("Character which ID: " + id + " doesn`t exist.<br />");
    }
}

function makeSituation(string) {
    document.write("<i>** " + string + " **</i><br />");
}

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.<br />");
    }
}

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 code1
  • Rob Pungello

    makeSituation(“Luke was to week to defeat Darth Vader, he escapes.”);

    *too
    *weak

  • Alan Kononowicz

    It is just typo. ;p