codingame/FACILE/La descente/script.php
2015-03-02 19:42:39 +01:00

51 lines
1 KiB
PHP

<?php
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
// game loop
while (TRUE)
{
fscanf(STDIN, "%d %d",
$SX,
$SY
);
$MHs = [];
for ($i = 0; $i < 8; $i++)
{
fscanf(STDIN, "%d",
$MH // represents the height of one mountain, from 9 to 0. Mountain heights are provided from left to right.
);
$MHs[] = $MH;
}
error_log(var_export($MHs, true));
// Write an action using echo(). DON'T FORGET THE TRAILING \n
// To debug (equivalent to var_dump): error_log(var_export($var, true));
$tolder = null;
$key = null;
foreach ($MHs as $k => $v) {
if ($tolder === null) {
$key = $k;
$tolder = $v;
} else {
if ($v > $tolder) {
$key = $k;
$tolder = $v;
}
}
}
if ($SX === $key) {
echo "FIRE\n";
} else {
echo "HOLD\n";
}
}
?>