#!/usr/bin/php <?php while (1) { $line = rtrim(fgets(STDIN, 1024)); // watch the game time to update settings based on time if ( preg_match( "/^GAME_TIME/", $line ) ){ $keywords = preg_split("/ /", $line); $game_time=$keywords[1]; if ( $game_time % 10 == 0 ){ $mincoord=225; $maxcoord=275; $minsize=2; $maxsize=8; $minspeed=1; $maxspeed=30; $xcoord=rand($mincoord, $maxcoord); $ycoord=rand($mincoord, $maxcoord); $size=rand($minsize, $maxsize); $xspeed=rand($minspeed, $maxspeed); $yspeed=rand($minspeed, $maxspeed); $ycoord2=($ycoord>250)?(250-($ycoord-250)):(250+(250-$ycoord)); $xcoord2=($xcoord>250)?(250-($xcoord-250)):(250+(250-$xcoord)); if ( $game_time%20==0 ) { print("spawn_zone death $xcoord $ycoord $size 0 $xspeed $yspeed true\n"); print("spawn_zone death $xcoord2 $ycoord2 $size 0 -$xspeed -$yspeed true\n"); } else { print("spawn_zone death $xcoord $ycoord $size 0 -$xspeed $yspeed true\n"); print("spawn_zone death $xcoord2 $ycoord2 $size 0 $xspeed -$yspeed true\n"); } } } } ?>