public void TestDoubleExit() { Graph graph = new Graph(6); graph.AddBidirectionnalLink(0, 1); graph.AddBidirectionnalLink(1, 2); graph.AddBidirectionnalLink(2, 3); graph.AddBidirectionnalLink(3, 4); graph.AddBidirectionnalLink(3, 5); List <int> exits = new List <int>(); exits.Add(0); exits.Add(4); exits.Add(5); Context context = new Context(); context.Graph = graph; context.Exits = exits; context.SkynetNode = 2; var result = Algo2.Play(context); Assert.AreEqual("3 4", result); }
static void Main(string[] args) { Context context = new Context(); string[] inputs; inputs = Console.ReadLine().Split(' '); int N = int.Parse(inputs[0]); // the total number of nodes in the level, including the gateways int L = int.Parse(inputs[1]); // the number of links int E = int.Parse(inputs[2]); // the number of exit gateways context.Graph = new Graph(N); for (int i = 0; i < L; i++) { inputs = Console.ReadLine().Split(' '); int N1 = int.Parse(inputs[0]); // N1 and N2 defines a link between these nodes int N2 = int.Parse(inputs[1]); context.Graph.AddBidirectionnalLink(N1, N2); } for (int i = 0; i < E; i++) { int EI = int.Parse(Console.ReadLine()); // the index of a gateway node context.Exits.Add(EI); } // game loop while (true) { int SI = int.Parse(Console.ReadLine()); // The index of the node on which the Skynet agent is positioned this turn context.SkynetNode = SI; Console.WriteLine(Algo2.Play(context)); // Write an action using Console.WriteLine() // To debug: Console.Error.WriteLine("Debug messages..."); // Example: 0 1 are the indices of the nodes you wish to sever the link between } }