[php]
$correctarray = array(“correct!”, “that is right. now, how about”, “okay, what about “, “yes! next:”);
$introchoice = $correctarray[array_rand($correctarray)];
$wordarray = array(“dance”, “#zen”, “moon”, “tortoise”, “guru”, “Goddess”, “school”, “philosophy”, “philosophizing”, “sunflower”, “tyger”, “banker”, “bank”, “lawyer”, “guard”, “lake”, “seed”, “robes”, “home”, “hut”, “judge”, “hemlock”, “village”, “truth”, “lie”, “tea”, “cup”, “knowledge”, “nothing”, “proof”, “nothing”, “lettuce”, “opposite”, “love”, “life”, “reality”, “sound”, “koan”, “tongue”, “speech”, “trip”, “mind”, “existence”, “illusion”, “reality”, “wisdom”, “song”, “afterlife”, “soul”, “question”, “answer”, “secret”, “happiness”, “number”, “path”, “teachings”, “forgiveness”, “meaning”, “#zenlightenment”, “belief”, “police”, “witness”, “oracle”, “island”, “meditation”, “student”, “professor”, “river”, “value”, “tree”, “shade”, “bum”, “universe”, “fast”, “moondust”, “lawsuit”, “dream”, “thirst”, “death”, “shell”, “rock”, “regret”, “beauty”, “shore”, “bodhi”, “haiku”, “fish”, “light”, “conclusion”, “cloud”, “rain”, “sunshine”, “ducat”, “trial”, “advice”, “contradiction”, “usury”, “lunch”, “cactus”, “vision”, “spa”, “friend”, “message”, “trick”, “revelation”, “sophist”, “contest”, “argument”, “guilt”, “graffiti”, “interest”, “beatitude”, “test”, “sleep”, “oracle”, “boat”, “#zen”, “philosophy”, “hut”, “tyger”, “cup”, “knowledge”, “lettuce”, “reality”, “tongue”, “mind”, “haiku”, “guru”, “Goddess”, “tortoise”, “sunflower”, “villager”);
$wordchoice = $wordarray[array_rand($wordarray)];
if (($_GET[‘c’] == “new”) or ($_GET[‘c’] == “”)) {
$vowelcount = preg_match_all(‘/[aeiou]/i’,$wordchoice,$matches);
$evencheck = ($vowelcount)%2;
if ($evencheck == 1) $_SESSION[‘answer’] = “black”;
else $_SESSION[‘answer’] = “white”;
echo ‘
a penguin said, “‘.$wordchoice.’. black or white?”
‘;
echo ‘black or white?’;
}
elseif ($_GET[‘c’] == $_SESSION[‘answer’]) {
$_SESSION[‘answercount’] = $_SESSION[‘answercount’]+1;
if ($_SESSION[‘answercount’] > 8) {
$_SESSION[‘answercount’] = 0;
echo ‘
a penguin said, “you talk like a penguin!” and then he waddled off.
‘;
echo ‘
‘;
}
else {
$vowelcount = preg_match_all(‘/[aeiou]/i’,$wordchoice,$matches);
$evencheck = ($vowelcount)%2;
if ($evencheck == 1) $_SESSION[‘answer’] = “black”;
else $_SESSION[‘answer’] = “white”;
echo ‘
a penguin said, “‘.$introchoice.’ ‘.$wordchoice.’. black or white?”
‘;
echo ‘black or white?’;
}
}
elseif ($_GET[‘c’] != $_SESSION[‘answer’]) {
$_SESSION[‘answercount’] = 0;
echo ‘
a penguin said, “no! that is wrong! ‘.$_SESSION[‘oldanswer’].’ is ‘.$_SESSION[‘answer’].’.”
‘;
echo ‘try again?‘;
}
$_SESSION[‘oldanswer’] = $wordchoice;
[/php]