private void LoadFile(string fileName) { var gameFile = GameFile.Load(fileName); foreach (var moveCommand in gameFile.MoveCommands) { Assert.IsTrue(Game.TryPossibleMoveCommand(moveCommand)); } }
public void TestGamePerformance() { #if DEBUG Assert.Fail("Run this test in release configuration"); #endif var gameFile = GameFile.Load("TestGames\\performance1.txt"); Game.Load(gameFile); var engine = new Engine(); var evaluation = engine.BestMoveDeepeningSearch(Game, TimeSpan.FromSeconds(10)); Console.WriteLine(evaluation); }
public void TestDrawby50moverule() { var game = new Game(); game.New(); var gameFile = GameFile.Load("TestGames\\drawby50moverule.txt"); game.Load(gameFile); Assert.IsTrue(game.Ended); game.UndoLastMove(); Assert.IsFalse(game.Ended); Assert.IsTrue(game.TryStringMove("h8-g8")); Assert.IsTrue(game.Ended); }
public void TestCopyGame() { var game = new Game(); game.New(); var gameFile = GameFile.Load("TestGames\\mated.txt"); foreach (var command in gameFile.MoveCommands) { Assert.IsTrue(game.TryPossibleMoveCommand(command)); } var copy = game.Copy(); Assert.AreNotSame(game, copy); }
public void TestSaveLoad() { var game = new Game(); game.New(); Assert.IsTrue(game.TryStringMove("e2-e4")); Assert.IsTrue(game.TryStringMove("e7-e5")); var gameFile = new GameFile(game); var fileName = @"gamefile.txt"; gameFile.Save(fileName); var loaded = GameFile.Load(fileName); for (int i = 0; i < gameFile.MoveCommands.Count; i++) { Assert.AreEqual(gameFile.MoveCommands[i].ToString(), loaded.MoveCommands[i].ToString()); } }