static void Main(string[] args) { string[] inputs; int projectCount = int.Parse(Console.ReadLine()); for (int i = 0; i < projectCount; i++) { var projects = Molecules.Parse(Console.ReadLine().Split(' '), 0); } // game loop while (true) { var gs = new GameState(); for (int i = 0; i < 2; i++) { inputs = Console.ReadLine().Split(' '); gs.Robots.Add(Robot.Parse(i, inputs)); } inputs = Console.ReadLine().Split(' '); gs.Available = Molecules.Parse(inputs, 0); int sampleCount = int.Parse(Console.ReadLine()); for (int i = 0; i < sampleCount; i++) { inputs = Console.ReadLine().Split(' '); gs.Samples.Add(Sample.Parse(inputs)); } // Write an action using Console.WriteLine() // To debug: Console.Error.WriteLine("Debug messages..."); var r = gs.Robots[0]; var robotBank = r.Storage + r.Expertise; foreach (var sample in r.PrioritySamples(gs)) { if (robotBank.CanSubtract(sample.Cost)) { Console.Error.WriteLine($"take {sample.Cost}"); robotBank -= sample.Cost; } else { var deficit = robotBank.Deficit(sample.Cost); Console.Error.WriteLine($"deficit: {deficit}"); } } var decision = Minimax.DecideMove(gs); if (decision == null) { Console.WriteLine("WAIT"); } else { decision.Execute(gs); } } }
public static Robot Parse(int id, string[] inputs) { return(new Robot { Id = id, Target = (LocationId)Enum.Parse(typeof(LocationId), inputs[0]), Eta = int.Parse(inputs[1]), Score = int.Parse(inputs[2]), Storage = Molecules.Parse(inputs, 3), Expertise = Molecules.Parse(inputs, 8), }); }
public static Sample Parse(string[] inputs) { return(new Sample { Id = int.Parse(inputs[0]), CarriedBy = int.Parse(inputs[1]), Rank = int.Parse(inputs[2]), ExpertiseGain = inputs[3].ParseMoleculeId(), Health = int.Parse(inputs[4]), Cost = Molecules.Parse(inputs, 5), }); }