<game name="ZeppelinTime">
	<room name="Zeppelin">
		<puzzle name="Name">
			<postcondition> spyName != null </postcondition>
			<description>Enter your name.  variable name: spyName</description>
			<environment><![CDATA[ "<html><b>Cargo Bay</b><br/><img src=\"http://farm1.static.flickr.com/14/17658656_32281b4d64.jpg?v=0\"/><br/>Fun for the whole family!<br/><br/>spyName = " + spyName + "</html>" ]]></environment>

			<hint>To create a variable, the general setup is &lt;variable type&gt; &lt;variable name&gt; = &lt;value&gt;;</hint>
			<hint>Your name consists of a series of characters (letters).  A series of characters is called a string.</hint>
			<hint>Here is an example of creating a variable: var great_name = \"Robert); DROP TABLE Students;--\"</hint>
			
			<solution>
				<text>Fine, I'll give you a name. See how you like it: spyName = \"Helpless\"</text>
				<script>spyName = \"Helpless\"</script>
			</solution>
		</puzzle>
		
		<puzzle name="Recognizer">
			<postcondition> authorizedPerson == spyName </postcondition>
			<description>Get the recognizer to recognize you.  Variable to reset: authorizedPerson.</description>
			<environment><![CDATA[ "<html><b>Cargo Bay</b><br/><img src=\"http://farm1.static.flickr.com/14/17658656_32281b4d64.jpg?v=0\"/><br/>Fool the recognizer!<br/><br/>Authorized person: " + authorizedPerson + "<br/>Your name: " + spyName + "</html>" ]]></environment>
			
			<hint>To change the value of a variable type &lt;variable_name&gt; = &lt;value&gt;;</hint>
			<hint>There's a certain variable here that specifies what person is authorized to pass. Currently, you shall not pass.</hint>
			
			<solution>
				<text>I'm telling the recognizer to let you through: authorizedPerson = spyName</text>
				<script>authorizedPerson = spyName</script>
			</solution>
		</puzzle>
		
		<puzzle name="OpenCargoBayDoor">
			<postcondition> handleRotation == 42 </postcondition>
			<description>Open the door.  Variable to reset: handleRotation</description>
			<environment><![CDATA[ "<html><b>Cargo Bay</b><br/><img src=\"http://farm1.static.flickr.com/14/17658656_32281b4d64.jpg?v=0\"/><br/>Open the door.<br/><br/>Handle rotation: " + handleRotation + "&#0186;</html>" ]]></environment>
			
			<hint>Remember: To create a variable, the general setup is &lt;variable type&gt; &lt;variable name&gt; = &lt;value&gt;; To set your name you entered \"spyName = &lt;spyName&gt;;\"</hint>
			<hint>We want to set the knob to having been turned a certain number of degrees.  It can be any rational number of degrees. In programming, we tend to call rational numbers 'floats'.</hint>
			<hint>Here is an example of creating a float variable: var pi = 3.14</hint>
			
			<solution>
				<text>The door handle needs to be at a 42 degree angle. Like this: handleRotation = 42</text>
				<script>handleRotation = 42</script>
			</solution>
		</puzzle>
	</room>
	
	<room name="Airlock">
		<puzzle name="EqualizePressure">
			<postcondition> airlockPressure == zeppelinPressure </postcondition>
			<description>Equalize the air pressure.  Variable names: airlockPressure, zeppelinPressure</description>
			<environment><![CDATA[ "<html><b>Airlock</b><br/><img src=\"http://farm3.static.flickr.com/2323/2189027815_9ffe8dfb4a.jpg?v=0\"/><br/>Equalize the air pressure.<br/><br/>Zeppelin pressure: " + zeppelinPressure + "<br/>Airlock pressure: " + airlockPressure + "</html>" ]]></environment>
			
			<hint>Variables are useful, but we also need procedural structure. In programming, we use \"control structures\" to control the flow of execution.</hint>
			<hint>Looks like a loop of some kind would be useful here. Maybe you should try a 'while' loop.</hint>
			<hint>The syntax of a 'while' loop is like this: while( &lt;condition&gt; ) { &lt;operations to perform&gt; };</hint>
			
			<solution>
				<text>I'm not going in there without air! Do it this way: while(airlockPressure &lt; zeppelinPressure) { airlockPressure += 1.0 }</text>
				<script>while(airlockPressure &lt; zeppelinPressure) { airlockPressure += 1.0 }</script>
			</solution>
		</puzzle>
		
		<puzzle name="OpenAirlockDoor">
			<postcondition> airlockPressure == zeppelinPressure &amp;&amp; airlockCombo[0] == 1 &amp;&amp; airlockCombo[1] == 9 &amp;&amp; airlockCombo[2] == 4 &amp;&amp; airlockCombo[3] == 1 </postcondition>
			<description>Open the door.  Array name: airlockCombo</description>
			<environment><![CDATA[ "<html><b>Airlock</b><br/><img src=\"http://farm3.static.flickr.com/2323/2189027815_9ffe8dfb4a.jpg?v=0\"/><br/>Unlock the door.<br/><br/>Current lock combination: " + airlockCombo[0] + "" + airlockCombo[1] + "" + airlockCombo[2] + "" + airlockCombo[3] + "</html>" ]]></environment>
			
			<hint>And what if we want to store things in a list, for instance? We could use an array, and then access each value by its index in the array.</hint>
			<hint>In most languages arrays use indexes, so the numbering starts from zero.</hint>
			<hint>The first item in an array named 'arr' would be arr[0]. Likewise, the second would be arr[1], and so on. Mainly just pretend that you're a pirate. Savvy?</hint>
			
			<solution>
				<text>Just because I know everything . . . oh hey, look: airlockCombo[0] = 1; airlockCombo[1] = 9; airlockCombo[2] = 4; airlockCombo[3] = 1;</text>
				<script>airlockCombo = new Array(1,9,4,1)</script>
			</solution>
		</puzzle>
	</room>
	
	<room name="EmpireStateBuilding">
		<puzzle name="MakeKey">
			<postcondition> madeKey &gt; 1 </postcondition>
			<description>Make a key.  Call it myKey.</description>
			<environment><![CDATA[ "<html><b>Empire State Building</b><br/><img src=\"http://l.yimg.com/g/images/spaceball.gif\"/><br/>You need a key to get in.</html>" ]]></environment>
			
			<hint>Remember creating an instance of a variable?  We said String name = \"" + spyName + "\".  Creating an instance of an object is much like that: var &lt;variableName&gt; = new &lt;object Type&gt;()</hint>
			<hint>If I wanted to create an instance of a object of type Season called fireflySeason2 I would type Season fireflySeason2 = new Season()</hint>
			
			<solution>
				<text>I see. Never send a human to do a machine's job. Creating a key by typing: var myKey = new Key();</text>
				<script>var dummyKey = new Key();</script>
			</solution>
		</puzzle>
		
		<puzzle name="OpenDrawer">
			<postcondition> officeDrawer.isOpen() </postcondition>
			<description>Open the drawer variable names: officeDrawer, myKey.</description>
			<environment><![CDATA[ "<html><b>Empire State Building</b><br/><img src=\"http://www.lfstyl.com/storage/KNF-DESK-4PIECE.jpg\"/><br/>Must be in the drawer...</html>" ]]></environment>
			
			<hint>Objects do stuff.  To tell the object to do something, the general structure is &lt;variableOfProperObjectType&gt;.&lt;method&gt;</hint>
			<hint>If I wanted you to answer on your own, I would say you.answer()</hint>
			<hint>Occasionally, the method has a variable passed into it.  In this case, we want to pass the method open the key that we are using to open the drawer.</hint>
			<hint>The form for passing a method a variable parameter is &lt;method&gt;(&lt;parameter&gt;). For example if I wanted you to answer a specific question I'd type you.answer(question1).</hint>
			
			<solution>
				<text>Deus Ex Machina. Opening the Drawer by typing drawer.open(myKey)</text>
				<script>var myKey = new Key(); myKey.cut(0); officeDrawer.open(myKey);</script>
			</solution>
		</puzzle>
		
		<puzzle name="DuplicateDocuments">
			<postcondition> clonedDocuments == true </postcondition>
			<description>Duplicate the documents.  Variable name: officeDrawer</description>
			<environment><![CDATA[ "<html><b>Empire State Building</b><br/><img src=\"http://www.lfstyl.com/storage/KNF-DESK-4PIECE.jpg\"/><br/>Now to make a copy...</html>" ]]></environment>
			
			<hint>Lets break the task down into steps.  1)Create a variable  2)Get the documents from the drawer 3)clone these documents</hint>
			<hint>Like all Java objects, the documents have method clone(), which creates an exact copy</hint>
			<hint>These documents are private variables, and thus can't be taken directly.  Luckily, type drawer has the method get Documents() which returns the documents</hint>
			<hint>officeDrawer.getDocuments().clone() will get you a clone of the documents.  Without setting this to a variable saved in your program, you won't actually be able to do anything with these documents, however.  Remember to save the cloned documents to a variable of the same type.</hint>
			
			<solution>
				<text>[dripping sarcasm] I love doing your work. I'll type mDocs = drawer.getDocuments().clone()</text>
				<script>clonedDocuments = true;</script>
			</solution>
		</puzzle>
		
		<puzzle name="MakeKeyCard">
			<postcondition> madeKeyCard &gt; 0 </postcondition>
			<description>Make a key card (which is not just a key, its of class KeyCard).  You have the variable declared as Key keyOut.</description>
			<environment><![CDATA[ "<html><b>Empire State Building</b><br/><br/></html>" ]]></environment>
			
			<hint>We need something that does everything a key does, but it also needs an electronic bar code.  When a class definition has the word \"extends\" &lt;class2&gt; it inherits everything from class 2, then does more.  Class KeyCard extends class Key.</hint>
			<hint>Class Poodle extends Class Dog. If I have a variable declared in the line Dog myDog;  I can set that dog to an instance of poodle by saying myDog = new Poodle();</hint>
			
			<solution>
				<text>We will commence enhancing the truth in... all right, it's just easier to give you the truth. Solving this problem is as simple as getMeOutOfHere = new KeyCard();</text>
				<script>new KeyCard();</script>
			</solution>
		</puzzle>
	</room>
	
	<initScript>
		var spyName = null;
	    var authorizedPerson = "Hat guy";
	    var handleRotation = 0;
	    var madeKey = 0;
	    var madeKeyCard = 0;
	    var clonedDocuments = false;
	
	    var airlockPressure = 0;
	    var zeppelinPressure = 30;
	    var airlockCombo = new Array(4);
	    airlockCombo[0] = 0;
	    airlockCombo[1] = 0;
	    airlockCombo[2] = 0;
	    airlockCombo[3] = 0;
	    
	    function Drawer(lockCombo) {
	    	this.drawerOpen = undefined;
	    	this.lockCombo = lockCombo;
	    }
	    
	    function open(key) {
	    	if(this.lockCombo == key.combo) { this.drawerOpen = true; }
	    }
	    
	    function close() {
	    	this.drawerOpen = false;
	    }
	    
	    function isOpen() {
	    	return this.drawerOpen == true;
	    }
	    
	    Drawer.prototype.open = open;
	    Drawer.prototype.close = close;
	    Drawer.prototype.isOpen = isOpen;
	    
	    var officeDrawer = new Drawer(0);
	    
	    function Key() {
	    	combo = 0;
	    	lookEverybodyIMadeAKey();
	    }
	    
	    function lookEverybodyIMadeAKey() {
	    	madeKey = madeKey + 1;
	    }
	    
	    function cut(combo) {
	    	this.combo = combo;
	    }
	    
	    Key.prototype.cut = cut;
	    
	    KeyCard.prototype = new Key();
	    function KeyCard() {
	    	lookEverybodyIMadeAKeyCard();
	    }
	    
	    function lookEverybodyIMadeAKeyCard() {
	    	madeKeyCard = madeKeyCard + 1;
	    }
	    
	    function Documents() {
	    }
	    
	    function clone() {
	    	documentsCloned = true;
	    }
	    
	    Documents.prototype.clone = clone;
	</initScript>
</game>