Advertisement
xTheEc0

CodinGame.com // Onboarding // Tutorial

Oct 22nd, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.12 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.IO;
  4. using System.Text;
  5. using System.Collections;
  6. using System.Collections.Generic;
  7.  
  8. /**
  9.  * CodinGame planet is being attacked by slimy insectoid aliens.
  10.  * <---
  11.  * Hint:To protect the planet, you can implement the pseudo-code provided in the statement, below the player.
  12.  **/
  13. class Player
  14. {
  15.     static void Main(string[] args)
  16.     {
  17.  
  18.         // game loop
  19.         while (true)
  20.         {
  21.             string enemy1 = Console.ReadLine(); // name of enemy 1
  22.             int dist1 = int.Parse(Console.ReadLine()); // distance to enemy 1
  23.             string enemy2 = Console.ReadLine(); // name of enemy 2
  24.             int dist2 = int.Parse(Console.ReadLine()); // distance to enemy 2
  25.  
  26.             // Write an action using Console.WriteLine()
  27.             // To debug: Console.Error.WriteLine("Debug messages...");
  28.            
  29.             if (dist1 < dist2) Console.WriteLine(enemy1);
  30.             else Console.WriteLine(enemy2);
  31.             //Console.WriteLine("name of the enemy"); // You have to output a correct ship name to shoot ("Buzz", enemy1, enemy2, ...)
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement