Exemplo n.º 1
0
        //Rename this method to Main() when running on CG
        static void MainX(string[] args)
        {
            TronPlayer player = null;

            //
            while (true)
            {
                //
                string   line   = Console.ReadLine();
                string[] inputs = line.Split(' ');
                int      N      = int.Parse(inputs[0]); // total number of players (2 to 4).
                int      P      = int.Parse(inputs[1]); // your player number (0 to 3).
                if (player == null)
                {
                    player = new TronPlayer(N, P);
                }
                //
                string serialization = "";
                serialization += line + "\n";
                for (int i = 0; i < N; i++)
                {
                    line           = Console.ReadLine();
                    serialization += line + "\n";
                }
                //
                string move = player.GetMove(serialization);
                Console.WriteLine(move);
            }
        }
Exemplo n.º 2
0
 public TronServer()
 {
     if (Directions.Count() == 0)
     {
         Directions.Add("UP", new Point(0, -1));
         Directions.Add("DOWN", new Point(0, 1));
         Directions.Add("RIGHT", new Point(1, 0));
         Directions.Add("LEFT", new Point(-1, 0));
     }
     human      = new TronHuman(0);
     Players[0] = new TronPlayer(PlayerSetup.Length, 0);
     Players[1] = new TronPlayer(PlayerSetup.Length, 1);
     Players[2] = new TronPlayer(PlayerSetup.Length, 2);
     Players[3] = new TronPlayer(PlayerSetup.Length, 3);
     States.Add(ServerGameState.Initial());
 }