private void PlaySingleGame(PgnGame game) { ChessGame chessGame = null; try { chessGame = ChessFactory.NewChessGame(); PlayTurns(game, chessGame); } catch (Exception e) { Console.WriteLine($"Game: {game?.ToString() ?? ""}"); Console.WriteLine($"Board:\n{chessGame.ToTextBoard()}"); Console.WriteLine($"Full PGN Text:\n{game.PgnText}"); Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); throw; } }
private static void ParseSingleFile(string file) { PgnGame game = null; var count = 1; try { var games = PgnGame.ReadAllGamesFromString(File.ReadAllText(file)); count = games.Count(); } catch { Console.WriteLine($"Failed: #{count}, {file}, {game?.ToString() ?? ""}"); if (game != null) { DumpGameInfo(game); } throw; } Console.WriteLine($"{count} games parsed from {file}"); }