<<if \$boat eq "left shore">>\n<<set \$boat = "right shore">>\n<<else>>\n<<set \$boat = "left shore">>\n<<endif>>\n<<display resolve>>
<<if \$isEmpty eq "true">>\nYou put the goatman in the boat\n<<set \$goatman = "in the boat"; \$isEmpty = "false">>\n<<else>>\nThe boat is already full!\n<<endif>>\n<<display resolve>>
<<if \$goatman eq "right shore">>\n <<if \$werewolf eq "right shore">>\n <<if \$straw eq "right shore">>\n <<set \$dumb = 1>>\n <<display ball>>\n <<endif>>\n <<endif>>\n <<endif>> \n \n <<if \$goatman eq "left shore" >>\n <<if \$werewolf eq "left shore">>\n <<if \$straw eq "left shore">>\n The three monsters begin to fight!!\n <<set \$dumb = 1>>\n [[Get the hell out of here]]\n \n <<endif>>\n <<endif>>\n <<endif>> \n\n \n <<if \$dumb eq 2>>\n <<if \$goatman eq \$straw>>\n <<if \$boat neq \$goatman>>\n <<set \$dumb = 1>>\n <<display goatStraw>>\n <<endif>>\n <<else if \$goatman eq \$werewolf>>\n <<if \$boat neq \$werewolf>>\n <<display weregoat>>\n <<set \$dumb = 1>>\n <<endif>>\n <<endif>>\n <<endif>>\n \n <<if \$dumb eq 2>>\n <<display situation>>\n <<endif>>
A Classic Puzzle
The werewolf chomps down on the goatman like a wolf on a goat. The scarecrow, seeing his oppertunity, flips you the crow and pushes you out of the boat.\n\nBAD ENDING
The goatman alone with the scarecrow, chews him mercilessly. Now alone with the werewolf, you are bitten, mauled and generally manhandled. \n\nBAD ENDING
<<set \$boat = "left shore"; \$goatman = "in the boat"; \$werewolf = "left shore"; \$straw = "left shore"; \$isEmpty = "false" ; \$dumb = 2>>\n\nYou find yourself in the company of an animated evil scarecrow, a goatman, and werewolf. \n\nYou have a small boat, which you need to cross a river. \n\nThe boat is so small it can only hold you and one other thing at a time.\n\nHowever.\n\nIf the goatman is left with the animated scarecrow, the goatman will eat the straw.\n\nIf the werewof is left with the goatman, the werewolf will devour him.\n\n<<display situation>>
<<if \$isEmpty eq "true">>\nYou put the werewolf in the boat\n<<set \$werewolf = "in the boat"; \$isEmpty = "false">>\n<<else>>\nThe boat is already full!\n<<endif>>\n<<display resolve>>
version.extensions.ifMacros={major:2,minor:0,revision:0};macros["if"]={handler:function(place,macroName,params,parser){\nvar conditions=[],clauses=[],srcOffset=parser.source.indexOf(">>",parser.matchStart)+2,src=parser.source.slice(srcOffset),endPos=-1,currentCond=parser.fullArgs(),currentClause="",t=0,nesting=0;\nfor(var i=0;i<src.length;i++){if(src.substr(i,9)=="<<endif>>"){nesting--;if(nesting<0){endPos=srcOffset+i+9;\nconditions.push(currentCond);clauses.push(currentClause);break;}}if((src.substr(i,6)=="<<else")&&nesting==0){conditions.push(currentCond);\nclauses.push(currentClause);currentClause="";t=src.indexOf(">>",i+6);if(src.substr(i+6,4)==" if "){currentCond=Wikifier.parse(src.slice(i+10,t));\n}else{currentCond="true";}i=t+2;}if(src.substr(i,5)=="<<if "){nesting++;}currentClause+=src.charAt(i);\n}try{if(endPos!=-1){parser.nextMatch=endPos;for(i=0;i<clauses.length;i++){if(eval(conditions.shift())){new Wikifier(place,clauses[i ].trim());\nbreak;}}}else{throwError(place,"can't find matching endif");}}catch(e){throwError(place,"bad condition: "+e.message);\n}}};
<<display setup>>