static void Main(string[] args) { string[] inputs; int myTeamId = int.Parse(Console .ReadLine()); // if 0 you need to score on the right of the map, if 1 you need to score on the left var game = new Game(); var master = new Forwarder() { IsMasterPlayer = true, Game = game }; var slave = new Forwarder() { IsMasterPlayer = false, Companion = master, Game = game }; master.Companion = slave; // game loop while (true) { List <GameObject> snaffles = new List <GameObject>(); List <GameObject> bludgers = new List <GameObject>(); inputs = Console.ReadLine().Split(' '); int myScore = int.Parse(inputs[0]); int myMagic = int.Parse(inputs[1]); inputs = Console.ReadLine().Split(' '); int opponentScore = int.Parse(inputs[0]); int opponentMagic = int.Parse(inputs[1]); game.MyMagic = myMagic; game.MyScore = myScore; game.OpponentMagic = opponentMagic; game.OpponentScore = opponentScore; int entities = int.Parse(Console.ReadLine()); // number of entities still in game for (int i = 0; i < entities; i++) { snaffles = new List <GameObject>(); bludgers = new List <GameObject>(); inputs = Console.ReadLine().Split(' '); int entityId = int.Parse(inputs[0]); // entity identifier string entityType = inputs[1]; // "WIZARD", "OPPONENT_WIZARD" or "SNAFFLE" (or "BLUDGER" after first league) int x = int.Parse(inputs[2]); // position int y = int.Parse(inputs[3]); // position int vx = int.Parse(inputs[4]); // velocity int vy = int.Parse(inputs[5]); // velocity int state = int.Parse(inputs[6]); // 1 if the wizard is holding a Snaffle, 0 otherwise switch (entityType) { case "WIZARD": if (entityId % 2 == 0) { master.X = x; master.Y = y; master.VX = vx; master.VY = vy; master.Holding = state == 1; } else { slave.X = x; slave.Y = y; slave.VX = vx; slave.VY = vy; slave.Holding = state == 1; } break; case "SNAFFLE": snaffles.Add( new GameObject() { Id = entityId, X = x, Y = y, VX = vx, VY = vy }); break; case "BLUDGER": bludgers.Add( new GameObject() { Id = entityId, X = x, Y = y, VX = vx, VY = vy }); break; } } master.DoSomething(snaffles, bludgers, myTeamId); slave.DoSomething(snaffles, bludgers, myTeamId); } }