public static int Main(string[] args) { try { var input = System.IO.File.ReadAllText(@"input.json"); var boardstring = System.Text.RegularExpressions.Regex.Match(input, @"\{.*\}").Value; ConsensusPlayer player = new ConsensusPlayer(); Board board = JsonConvert.DeserializeObject<Board>(boardstring); for (int i = 0; i < args.Length; i++) { if (args[i] == "-p") { player.Color = args[i + 1].ElementAt(0).ToString(); } } System.IO.File.WriteAllText(@"playercolor.txt", player.Color); System.IO.File.WriteAllLines(@"board.txt", board.squares); return player.chooseMove(board); } catch (Exception e) { System.IO.File.WriteAllText(@"Exception.txt", e.Message); return 0; } }
public static int Main(string[] args) { try { var input = System.IO.File.ReadAllText(@"input.json"); var boardstring = System.Text.RegularExpressions.Regex.Match(input, @"\{.*\}").Value; ConsensusPlayer player = new ConsensusPlayer(); Board board = JsonConvert.DeserializeObject <Board>(boardstring); for (int i = 0; i < args.Length; i++) { if (args[i] == "-p") { player.Color = args[i + 1].ElementAt(0).ToString(); } } System.IO.File.WriteAllText(@"playercolor.txt", player.Color); System.IO.File.WriteAllLines(@"board.txt", board.squares); return(player.chooseMove(board)); } catch (Exception e) { System.IO.File.WriteAllText(@"Exception.txt", e.Message); return(0); } }