if (!isset($_REQUEST[‘sun’])) { // if this is the first page
$_SESSION[‘hopcount’] = 0;
$_SESSION[‘crier’] = 0;
$_SESSION[‘crycount’] = 0;
$_SESSION[‘smilecount’] = 0;
$_SESSION[‘broke’] = false;
$_SESSION[‘tortoiseride’] = 0;
$ending = 0;
[/php]
the sunflower sat on the guru’s desk. she longed to see out the window and stare at the sun, but she was in a pot, and so there wasn’t much she could do.
[php]} else {
$turncount = $_SESSION[‘crycount’]+$_SESSION[‘smilecount’]+$_SESSION[‘hopcount’];
if ($_SESSION[‘crier’] > 0) $_SESSION[‘crier’]++; // increment crier, counter since cry
$interrupt = “none”;
if (($_REQUEST[‘sun’] == ‘hop’) and ($_SESSION[‘tortoiseride’] > 4)) $interrupt = “window”;
if (($_SESSION[‘crier’] == 5) and ($_REQUEST[‘sun’] != ‘hop’)) $interrupt = “mrstortoise”;
if ($turncount == 15) $interrupt = “sunset”;
if (($_REQUEST[‘sun’] == ‘smi’) and ($_SESSION[‘broke’] == true)) $interrupt = “passage”;
if (($_REQUEST[‘sun’] == ‘cry’) and ($_SESSION[‘broke’] == true)) $interrupt = “studrest”;
if ($interrupt == “none”) { // begin everything that isn’t a first
if ($_REQUEST[‘sun’] == ‘smi’) { // smiling 1
if ($_SESSION[‘tortoiseride’] > 0) {
if ($_SESSION[‘tortoiseride’] > 3) {
$_SESSION[‘tortoiseride’]++;
if ($_SESSION[‘tortoiseride’] > 5) echo “the sunflower continued to smile.”;
else echo “the sunflower smiled as mrs tortoise crawled to a stop.”;[/php]
they were still several feet beneath the window. however, a small string hung down from the blinds.
[php]
} else { // tortoise ride is between 0 and 3
$_SESSION[‘tortoiseride’]++;[/php]
the sunflower smiled as she rode on the tortoise.
[php]}} else { // if you’re not on the ride
$_SESSION[‘smilecount’]++;
if ($_SESSION[‘smilecount’] == 1) {[/php]
the sunflower smiled.
nothing happened.
[php]} // end of smile 1
elseif (($_SESSION[‘smilecount’] > 4) and ($_SESSION[‘hopcount’] == 0) and ($_SESSION[‘crycount’] == 0)) { // 5 smiles, no cries or hops
$ending = 1; [/php]
the sunflower smiled. she enjoyed the sun as it passed by the window.
[php]$_SESSION[‘newitem’] = “happiness”;
$_SESSION[‘zencolor’] = “yellow”;
[/php]
[php function=13]
[php]} elseif ($_SESSION[‘smilecount’] > 1) { // more than 1 smile or less than 5 [/php]
the sunflower smiled some more.
nothing continued to happen.
[php]} // end of the smile-count checks
} // end of the check to see if the tortoise ride
} elseif ($_REQUEST[‘sun’] == ‘cry’) { // cry out for help
if ($_SESSION[‘tortoiseride’] > 0) {
$randcheck = rand(1,3);
[/php]
the sunflower cried out for help.
[php]
echo “
“;
if ($randcheck == 1) echo ‘mrs tortoise said, “that\’s really not helpful.”‘;
if ($randcheck == 2) echo ‘mrs tortoise said, “will you please stop that.”‘;
if ($randcheck == 3) echo ‘mrs tortoise stopped walking and said, “that\’s so sad.”‘;
echo “
“;
} else {
if ($_SESSION[‘crier’] == 0) $_SESSION[‘crier’] = 1; // activate the criercount
$_SESSION[‘crycount’]++;
if ($_SESSION[‘crycount’] == 1) {
[/php]
the sunflower gathered all of her strength and cried out for help, but nobody came. possibly because there were no good people in the guru’s school, but also possibly because the sunflower did not have a lot of lung capacity on account of her being a plant.
[php]} // end the crycount 1
elseif ($_SESSION[‘crycount’] == 2) { // crycount = 2 [/php]
the sunflower cried out again, but she had to imagine that anyone who was coming was already on their way.
[php]} // end crycount = 2
elseif ($_SESSION[‘crycount’] == 3) { // crycount = 3[/php]
the sunflower cried out for help again.
a student ran into the room and said, “what is wrong?”
“i need to get to the window but i’m sitting on this desk,” the sunflower said.
“that’s ridiculous. that’s not an emergency.”
and he walked over and closed the window.
[php]$_SESSION[‘newitem’] = “darkness”;
$_SESSION[‘zencolor’] = “black”;
$ending = 1;
[/php]
[php function=13]
[php]
$_SESSION[‘end’] = true;
} // end crycount = 3
elseif ($_SESSION[‘crycount’] == 3) { // crycount = 3[/php]
mrs. tortoise appeared in the doorway of the guru’s office.
“is something wrong?” she asked.
“i want to get by the window but i’m in this desk!” the sunflower said.
“oh,” mrs. tortoise said, “that really is an emergency. let me help.”
and she walked slowly across the room until she was right next to the table.
“jump down onto my shell and i’ll carry you over!”
[php]} // end of the cry-count
} // end of the tortoise ride check
} elseif ($_REQUEST[‘sun’] == ‘hop’) { // hop 1
if ($_SESSION[‘tortoiseride’] > 0) { [/php]
the sunflower hopped off the tortoise, and her pot landed on the ground.
mrs tortoise looked at her and said, “why would you do that? now you’re stuck.”
[php]$_SESSION[‘newitem’] = “what happens when you hop off mrs tortoise”;
$_SESSION[‘zencolor’] = “green”;
[/php]
[php function=13]
[php]
$ending = 1;
} else {
$_SESSION[‘hopcount’]++;
if ($_SESSION[‘hopcount’] == 1) { // this is her first hop
[/php]
the sunflower bent down, gathered all of her strength in her stem, and hopped.
she was only slightly closer to the window.
[php]} // end of the first hop
elseif ($_SESSION[‘hopcount’] == 2) { // this is the second hop [/php]
again, the sunflower bent down, this time gathering all of her strength in her roots, and hopped. but her pot was heavy, and again, she barely moved.
[php]} elseif ($_SESSION[‘hopcount’] == 3) { // this is the third hop [/php]
once more, the sunflower planned to jump. but this time, she was going to meditate first. she closed her eyes and counted to #zen, and then leapt forward with all of her strength.
her pot moved another fraction, but now it teetered on the edge.
and then she fell.
[php]if ($_SESSION[‘crier’] < 6) { // if mrs tortoise isn't there[/php] the sunflower smashed into the ground. her pot cracked open and her dirt spilled over the floor. she could no longer hop. [php]$_SESSION['broke'] = true; } else { [/php] the sunflower spun tumbled through the air until she landed perfectly upright on the shell of mrs. tortoise, who said, "now to the window!" she began to crawl. [php] $_SESSION['tortoiseride'] = 1; } // end of the break/ride } // end of the tortoise ride check } // end of any hops } // the end of the basic smile/hop/cry switcher } // the end of the non-interrupts else { // the beginning of the interrupts if ($interrupt == "window") {[/php] the sunflower hopped off of the tortoise's shell and grabbed onto the string. by using all of the strength of her leaves, she managed to pull herself up to the window, where she set her pot and smiled up at the sun. however, the sun wasn't the only thing she saw. she also saw the tortoise, slowly crawling away from the village... [php]$_SESSION['newitem'] = "a clue"; $_SESSION['zencolor'] = "red"; $ending = 1; [/php]
[php function=13]
[php]
} elseif ($interrupt == “mrstortoise”) {[/php]
mrs. tortoise appeared in the doorway of the guru’s office.
“is something wrong?” she asked.
“i want to get by the window but i’m in this desk!” the sunflower said.
“oh,” mrs. tortoise said, “that really is an emergency. let me help.”
and she walked slowly across the room until she was right next to the table.
“jump down onto my shell and i’ll carry you over!”
[php]} elseif ($interrupt == “sunset”) { [/php]
the sun set, shrouding the room in darkness.
[php]$_SESSION[‘newitem’] = “darkness”;
$_SESSION[‘zencolor’] = “black”;
$ending = 1;
[/php]
[php function=13]
[php]
$ending = 1;
} elseif ($interrupt == “passage”) { [/php]
the sunflower smiled on the ground.
a student entered and looked around the room, but he did not see the sunflower.
he walked over to the guru’s bookshelf and removed a book, “1 path to #zen.”
then, the bookshelf opened up, revealing a dark hallway, and the student disappeared into the hallway.
[php]$_SESSION[‘newitem’] = “a secret passage”;
$_SESSION[‘zencolor’] = “orange”;
$ending = 1;
[/php]
[php function=13]
[php]
} elseif ($interrupt == “studrest”) { [/php]
a student entered and saw the sunflower lying on the ground.
he walked over to her, picked her up, and set her on the table, right where she started.
[php]$ending = 1;
} // the end of the interrupt selector
} // the end of the interrupts
} // the end of non-firsts
[/php]
[php]if ($ending != 1) {
if ($_SESSION[‘broke’] == false) {
[/php]the sunflower could smile[php]if ($_REQUEST[‘sun’] == ‘smi’) echo ‘ again'[/php], cry for help[php]if ($_REQUEST[‘sun’] == ‘cry’) echo ‘ again'[/php], or hop[php]if ($_REQUEST[‘sun’] == ‘hop’) echo ‘ again'[/php].
[php]} else { // if broke is true[/php]
the sunflower could smile[php]if ($_REQUEST[‘sun’] == ‘smi’) echo ‘ again'[/php] or cry for help[php]if ($_REQUEST[‘sun’] == ‘cry’) echo ‘ again'[/php].
[php]}} else { // if it is in fact the ending[/php]
play again?
[php]}[/php]