public static LinkGameField ParseText() { string[] line; if (Console.ReadLine() != "START") throw new Exception(); line = Console.ReadLine().Split(' '); int turn = int.Parse(line[0]), maxTurn = int.Parse(line[1]), playerTurn = int.Parse(line[2]); line = Console.ReadLine().Split(' '); LinkGameField result = new LinkGameField(int.Parse(line[0]), turn, maxTurn, playerTurn); int count = int.Parse(line[1]); for (int i = 0; i < count; i++) { line = Console.ReadLine().Split(' '); int x = int.Parse(line[0]), y = int.Parse(line[1]), player = int.Parse(line[2]), robot = int.Parse(line[3]); result.FromRedress(ref x, ref y); Terrain ter = ParseTerrain(line[5], line[6]); if (player == playerTurn) { result.field[x, y] = new GameMass { Player = player, Terrain = ter, ActiveRobot = robot }; } else { result.field[x, y] = new GameMass { Player = player, Terrain = ter, WaitRobot = robot }; } } if (Console.ReadLine() != "EOS") throw new Exception(); return result; }
public LinkCommander(LinkGameField parent) { this.parent = parent; }