public void PlayGame(Bot bot) { Log.Debug("Starting Up"); //while (!Debugger.IsAttached) //{ // Thread.Sleep(100); //} List <string> input = new List <string>(); try { while (true) { string line = System.Console.In.ReadLine().Trim().ToLower(); if (line.Equals(READY)) { ParseSetup(input); FinishTurn(); input.Clear(); } else if (line.Equals(GO)) { state.StartNewTurn(); ParseUpdate(input); bot.DoTurn(state); FinishTurn(); input.Clear(); } else if (line.Equals(END)) { break; } else { input.Add(line); } } } catch (Exception e) { #if DEBUG Log.Fatal(e, "Fatal error "); FileStream fs = new FileStream("debug.log", System.IO.FileMode.Create, System.IO.FileAccess.Write); StreamWriter sw = new StreamWriter(fs); sw.WriteLine(e); sw.Close(); fs.Close(); #endif } }
public void PlayGame(Bot bot) { Log.Debug("Starting Up"); List <string> input = new List <string>(); try { while (true) { string line = System.Console.In.ReadLine().Trim().ToLower(); if (line.Equals(READY)) { ParseSetup(input); bot.Initialize(state); FinishTurn(); input.Clear(); } else if (line.Equals(GO)) { state.StartNewTurn(); ParseUpdate(input); state.CalculateVisibility(); state.ClearHills(); bot.DoTurn(state); FinishTurn(); input.Clear(); } else if (line.Equals(END)) { break; } else { input.Add(line); } } } catch (Exception e) { #if DEBUG FileStream fs = new FileStream("debug.log", System.IO.FileMode.Create, System.IO.FileAccess.Write); StreamWriter sw = new StreamWriter(fs); sw.WriteLine(e); sw.Close(); fs.Close(); #endif } }