From 3863675e6ae80f7d2dafdb4edd50d4cbe6cb49e1 Mon Sep 17 00:00:00 2001 From: Joshua Jeschek Date: Sat, 22 Jul 2023 22:41:25 +0200 Subject: [PATCH] fix: allow for empty lines in Fens.txt file --- .../src/Framework/Application/Core/ChallengeController.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Chess-Challenge/src/Framework/Application/Core/ChallengeController.cs b/Chess-Challenge/src/Framework/Application/Core/ChallengeController.cs index f27ed51..7a1b89a 100644 --- a/Chess-Challenge/src/Framework/Application/Core/ChallengeController.cs +++ b/Chess-Challenge/src/Framework/Application/Core/ChallengeController.cs @@ -3,6 +3,7 @@ using ChessChallenge.Example; using Raylib_cs; using System; using System.IO; +using System.Linq; using System.Runtime.ExceptionServices; using System.Text; using System.Threading; @@ -66,7 +67,7 @@ namespace ChessChallenge.Application BotStatsA = new BotMatchStats("IBot"); BotStatsB = new BotMatchStats("IBot"); - botMatchStartFens = FileHelper.ReadResourceFile("Fens.txt").Split('\n'); + botMatchStartFens = FileHelper.ReadResourceFile("Fens.txt").Split('\n').Where(fen => fen.Length > 0).ToArray(); botTaskWaitHandle = new AutoResetEvent(false); StartNewGame(PlayerType.Human, PlayerType.MyBot); @@ -448,4 +449,4 @@ namespace ChessChallenge.Application boardUI.Release(); } } -} \ No newline at end of file +}