ifComparison.php

Source of ifComparison.php

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>ifComparison</title>
</head>
<body>
<p>You are working on a software project. Let's see how you do...</p>

<?php

$tensDie = rand(1,10);
$onesDie = rand(1,10);

print "<p><img src=\"10sided$tensDie.png\" /><img src=\"10sided$onesDie.png\" /><br />";

if($onesDie == 10)
		$onesDie = 0;//if ones die == 10, make it zero.

if($tensDie == 10){
	if($onesDie != 0){
		print "You rolled a $onesDie</p>";
	}else{
		print "You rolled 100!</p>";
	}
}else{
	print "Your rolled $tensDie$onesDie</p>";
}

print "<p>";
if($tensDie != 10){
	if($tensDie <= 4){
		print "Your project is a failure. It is $tensDie years late and " . $onesDie . "00% over budget before it finally gets canceled. All of your co-workers are disgruntled and send each other's code to worsethanfailure.com";
	}else if($tensDie <= 7){
		print "Your project is only a partial success. It is " . $tensDie * 3 . " months late and " . $onesDie . "0% over budget. It is never incredibly successfuly implemented, but it puts food on the table.";
	}else if($tensDie < 9){
		print "Your project is a success. It is only $tensDie weeks late and has " . $onesDie . "% of the features originally planned, but it survives through " . ($tensDie + $onesDie) . " more releases before it is obsolete.";
	}else{
		print "Your project is a huge success! ";
		if($onesDie == 9){
			print " It is purchased by Google, and you are snatched up along with it. You lucky entrepreneur you...";
		}else{
			print " It remains an industry standard for the next $onesDie years, making you filthy rich.";
		}
	}
} else {
	if($onesDie == 0){
		print "When you were born, your mother christened you \"William Gates\", and the rest is history.";
	}else{
		print "Someone burns your office down and you lose your job. Better luck next time.";
	}
}
print "</p>";

?>

<a href="ifComparison.php">Try Again!</a>

</body>
</html>