static void Main(string[] args) { var game = new Chess.Chess.Game(); Console.Write(game); while (game.BlackPosition.Any(x => x.symbol == "K") && game.WhitePosition.Any(x => x.symbol == "K")) { Chess.Chess.Piece move; do { move = Chess.Chess.InterpretMove(); } while (!game.ValidMove(move)); game = game.Move(move); Console.Write(game.ToString()); var tankerekke = GameNode.GetBestMoves(game, 5); game = tankerekke.BestNode.game; Console.Write(game.ToString()); } return; //while (tankerekke.game.BlackPosition.Any(x => x.symbol == "K") && tankerekke.game.WhitePosition.Any(x => x.symbol == "K")) { // Console.Write(tankerekke.BestNode.game.ToString()); // Console.WriteLine("--------------------------------"); // tankerekke = GameNode.GetBestMoves(tankerekke.BestNode.game, 4); //} //while(tankerekke != null){ // Console.Write(tankerekke.game.ToString()); // Console.WriteLine("--------------------------------"); // tankerekke = tankerekke.BestNode; //} }
static void Main(string[] args) { var game = new Chess.Chess.Game(); var secondsPerMove = 20; while (game.BlackPosition.Any(x => x.symbol == "K") && game.WhitePosition.Any(x => x.symbol == "K")) { Chess.Chess.Piece move; move = Chess.Chess.InterpretMove(); while (!game.ValidMove(move)) { Console.WriteLine("Invalid move, try again"); move = Chess.Chess.InterpretMove(); } game = game.Move(move); Console.Write(game.ToString()); var tankerekke = GameNode.GetBestMoves(game, DateTime.Now.AddSeconds(secondsPerMove)); game = tankerekke.BestNode.game; Console.Write(game.ToString()); } return; //while (tankerekke.game.BlackPosition.Any(x => x.symbol == "K") && tankerekke.game.WhitePosition.Any(x => x.symbol == "K")) { // Console.Write(tankerekke.BestNode.game.ToString()); // Console.WriteLine("--------------------------------"); // tankerekke = GameNode.GetBestMoves(tankerekke.BestNode.game, 4); //} //while(tankerekke != null){ // Console.Write(tankerekke.game.ToString()); // Console.WriteLine("--------------------------------"); // tankerekke = tankerekke.BestNode; //} }
public void TestAISpeed() { //while(game.BlackPosition.Any(x => x.symbol == "K") && game.WhitePosition.Any(x => x.symbol == "K")) { var game = new Chess.Chess.Game(); for (int ii = 1; ii <= 30; ii++) { var tankerekke = GameNode.GetBestMoves(game, 5); game = tankerekke.BestNode.game; Console.Write(game.ToString()); } Assert.IsTrue(true); }