#!/usr/bin/php
<?php
$maps=array("map1.aamap.xml","map2.aamap.xml");
while (1)  {
    $line = rtrim(fgets(STDIN, 1024));
    if ( preg_match( "/^ROUND_COMMENCING/", $line ) ){
        $keywords = preg_split("/ /", $line);
   $map=rand (0 , count($maps )-1);
        echo "MAP_FILE ".$maps[$map]."\n";
        echo "WAIT_FOR_EXTERNAL_SCRIPT 0\n";
        sleep(6);
        echo "WAIT_FOR_EXTERNAL_SCRIPT 1\n";
    }
}
?>