Advertisement
Loss1k

Untitled

Jul 5th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. <?php
  2. /**
  3.  * CodinGame planet is being attacked by slimy insectoid aliens.
  4.  * <---
  5.  * Hint:To protect the planet, you can implement the pseudo-code provided in the statement, below the player.
  6.  **/
  7.  
  8.  
  9. // game loop
  10. while (TRUE)
  11. {
  12.     fscanf(STDIN, "%s",
  13.         $enemy1 // name of enemy 1
  14.     );
  15.     fscanf(STDIN, "%d",
  16.         $dist1 // distance to enemy 1
  17.     );
  18.     fscanf(STDIN, "%s",
  19.         $enemy2 // name of enemy 2
  20.     );
  21.     fscanf(STDIN, "%d",
  22.         $dist2 // distance to enemy 2
  23.     );
  24.  
  25.     // Write an action using echo(). DON'T FORGET THE TRAILING \n
  26.     // To debug (equivalent to var_dump): error_log(var_export($var, true));
  27.  
  28.     echo("enemy\n"); // replace "enemy" with a correct ship name to shoot
  29. }
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement