ifLogical.php

Source of ifLogical.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>ifLogical</title>
</head>
<body>
<h1>Spacewar!</h1>
<p>It is 1962. You are Steve Russell hard at work on your DEC PDP-1 Computer trying to invent the very first computer game, "Spacewar!"</p>
<p>Everything would be going great if only you could get the Cathode-Ray Tubes to work. There are two that are giving you trouble. They are getting either too much, or too little power, but you just need one to work to play the game. Try restarting until one works!</p>
<?php

//set random power level
$crt1 = rand(1,10);
$crt2 = rand(1,10);

print <<<HERE
<p>Your CRTs (need one to be green):<br />
<img src="crt$crt1.png" />
<img src="crt$crt2.png" /></p>
HERE;

//see if one crt's power levels is between 4 and 6 (inclusive)...
if(($crt1 >= 4 && $crt1 <= 6) || ($crt2 >= 4 && $crt2 <= 6)){
	print"<p>SPACEWAR! <a href=\"ifLogical.php\">Play again</a>...<br /><img src=\"computerOn.png\" /></p>";
}else{
	print"<p>No Go... <a href=\"ifLogical.php\">Try again</a>...<br /><img src=\"computerOff.png\" /></p>";
}
?>
</body>
</html>