예제 #1
0
        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;
            //}
        }
예제 #2
0
파일: Program.cs 프로젝트: eriklien/sjakk
        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;
            //}
        }