Exemple #1
0
        static void Main(string[] args)
        {
            Random        random = new Random();
            Chess         chess  = new Chess(); // ("rnbqkbnr/pp1111pp/8/8/8/8/PP11111P/RNBQKBNR w KQkq - 0 1");
            List <string> listMoves;

            while (true)
            {
                listMoves = chess.GetAllMoves();
                Console.WriteLine(chess.fen);
                Print(ChessToASCII(chess));
                Console.WriteLine(chess.isCheck() ? "CHECK" : "-");
                foreach (string moves in listMoves)
                {
                    Console.Write(moves + "\t");
                }
                Console.WriteLine();
                Console.Write("> ");
                string move = Console.ReadLine();
                if (move == "q")
                {
                    break;
                }
                if (move == "")
                {
                    move = listMoves[random.Next(listMoves.Count)];
                }
                chess = chess.Move(move);
            }
        }