function calculateHit($pigHealth) { global $maximumThrows; //global $pigHealth; static $aantalkeer = 0; if ($aantalkeer < $maximumThrows) { $raakKans = rand(1, 10); if ($raakKans < 5) { --$pigHealth; if ($pigHealth > 1) { echo '<p>Raak! Er zijn nog maar ' . $pigHealth . ' varkens over.</p>' . 'raakansvariabele = ' . $raakKans; } else { echo '<p>Raak! Nog 1 varken over! ' . 'raakansvariabele = ' . $raakKans; } } else { echo '<p>Mis! Er zijn nog maar ' . $pigHealth . ' varkens over.</p>' . 'raakansvariabele = ' . $raakKans; } ++$aantalkeer; calculateHit($pigHealth); } else { if ($pigHealth < 1) { echo '<p><b>Gewonneuh!</b></p>'; } else { echo '<p><b>Verloren!</b></p>'; } } }
function launchAngryBird() { static $launchAmount = 0; global $maxThrows; global $pigHealth; if ($launchAmount < $maxThrows) { $launchAmount++; echo calculateHit(); if ($pigHealth != 0) { launchAngryBird(); } } }
function launchAngryBird() { global $pigHealth, $maximumThrows; static $aantalKeer = 0; $boodschap = ""; while ($aantalKeer < $maximumThrows) { $aantalKeer++; $boodschap .= calculateHit() . "<br>"; } if ($pigHealth > 0) { $boodschap .= "verloren!"; } else { $boodschap .= "gewonnen!"; } return $boodschap; }
function launchAngryBird() { static $aantalKeerAangeroepen; global $maximumThrows; global $pigHealth; echo calculateHit(); $aantalKeerAangeroepen++; if ($aantalKeerAangeroepen == $maximumThrows) { if ($pigHealth <= 0) { echo "Gewonnen<br />"; } else { echo "Verloren<br />"; } } else { launchAngryBird(); } }
function launchAngryBird() { static $functionLaunched = "0"; global $maximumThrows; global $pigHealth; calculateHit(); if ($functionLaunched < $maximumThrows) { $functionLaunched++; launchAngryBird(); } elseif ($functionLaunched == $maximumThrows) { if ($pigHealth <= 0) { echo "Gewonnen!"; return; } else { echo "Verloren!"; } } }
function launchAngryBird() { global $pigHealth; global $maximumThrows; global $spelverloop; if ($maximumThrows != 0 && $pigHealth > 0) { $hitResult = calculateHit(); --$maximumThrows; $spelverloop[] = $hitResult['string']; launchAngryBird(); } else { if ($pigHealth > 0) { $spelverloop[] = 'Helaas, je hebt verloren.'; } else { $spelverloop[] = 'Hoera! Hoera! Hoera! Je hebt gewonnen!'; } } }
function LaunchAngryBirds($numberOfThrowsLeft, $pighealth) { //static $count = 0; static $result = array(); $result["victory"] = "Het spel is bezig."; $result["throwsLeft"] = $numberOfThrowsLeft; $pighealth = calculateHit($pighealth); $result[$numberOfThrowsLeft] = $pighealth; if ($pighealth <= 0) { $result["victory"] = "U heeft GEWONNEN ! "; } else { if ($numberOfThrowsLeft > 0) { LaunchAngryBirds(--$numberOfThrowsLeft, $pighealth); } else { $result["victory"] = "U heeft verloren... probeer het nog eens."; } } return $result; }
function launchAngryBird() { static $loung_made = 0; global $maximumThrows, $pigHealth, $spelverloop; //echo $maximumThrows . " " .$pigHealth. " ".$loung_made."<br>"; $loung_made++; if ($loung_made <= $maximumThrows && $pigHealth > 0) { $hit_result = calculateHit(); $spelverloop[] = $hit_result["massege"]; //echo $hit_result["massege"]; launchAngryBird(); } else { if ($pigHealth == 0) { $spelverloop[] = "Gewonnen! <br>"; } else { $spelverloop[] = "Verloren! <br>"; } //echo "ik ben hier".$spelverloop[1]; } }
function launchAngryBird() { global $pigHealth; global $maximumThrows; global $game; //anders herkent de functie het ni if ($maximumThrows != 0 && $pigHealth > 0) { $hit = calculateHit(); $maximumThrows--; $game[] = $hit['pigs']; launchAngryBird(); } else { if ($pigHealth == 0) { $game[] = "gewonnen!"; //exit(); } else { $game[] = "verloren!"; } } }
function launchAngryBird() { global $maximumThrows; global $pigHealth; global $uitkomst; if ($maximumThrows != 0 && $pigHealth > 0) { $maximumThrows--; # Calculatehit returnt $stringsToPrintArray $hit = calculateHit(); # Steek deze strings in de nieuwe array $uitkomst $uitkomst[] = $hit['string']; # Zo lang er nog pigs zijn en het max aantal beurten niet overschreden wordt blijft de functie zich herhalen. launchAngryBird(); } else { if ($pigHealth <= 0) { $uitkomst[] = 'Gewonnen!!'; } else { $uitkomst[] = 'Verloren... :('; } } }
function launchAngryBird($pigHealth, $maximumThrows) { static $fCount = 0; if ($fCount < $maximumThrows && $pigHealth != 0) { ++$fCount; if (calculateHit()) { if ($pigHealth === 2) { --$pigHealth; echo '<p>Raak! Er is nog maar ' . $pigHealth . ' varken over.</p>'; return launchAngryBird($pigHealth, $maximumThrows); } else { --$pigHealth; echo '<p>Raak! Er zijn nog maar ' . $pigHealth . ' varkens over.</p>'; return launchAngryBird($pigHealth, $maximumThrows); } } else { if ($pigHealth === 1) { $mis = '<p>Mis! Nog ' . $pigHealth . ' varken in het team.</p>'; echo $mis; return launchAngryBird($pigHealth, $maximumThrows); } else { $mis = '<p>Mis! Nog ' . $pigHealth . ' varkens in het team.</p>'; echo $mis; return launchAngryBird($pigHealth, $maximumThrows); } } } elseif ($fCount === $maximumThrows || $pigHealth === 0) { $einde = ''; if ($pigHealth === 0) { $einde = '<p>Gewonnen!</p>'; echo $einde; } elseif ($pigHealth > 0) { $einde = '<p>Verloren!</p>'; echo $einde; } } }