Beispiel #1
0
        static void Main(string[] args)
        {
            Random        random = new Random();
            Chess         chess  = new Chess();
            List <string> list;

            while (true)
            {
                Console.WriteLine(chess.fen);
                list = chess.GetAllMoves();
                Print(ChessToAscii(chess));
                Console.WriteLine(chess.IsCheck() ? "CHECK" : "-");
                foreach (string moves in list)
                {
                    Console.Write(moves + "\t");
                }
                Console.WriteLine();
                Console.Write("> ");
                string move = Console.ReadLine();
                if (move == "q")
                {
                    break;
                }
                if (move == "")
                {
                    move = list[random.Next(list.Count)];
                }
                chess = chess.Move(move);
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Chess chess = new Chess("rnbqkbnr/1p1111p1/8/8/8/8/1P1111P1/RNBQKBNR w KQkq - 0 0");

            while (true)
            {
                Console.WriteLine(chess.GetFen());
                foreach (string moves in chess.GetAllMoves())
                {
                    Console.WriteLine(moves + "\t");
                }
                Console.WriteLine(chess.IsCheck()?"CHECK!":"");
                Console.WriteLine();
                Console.WriteLine(ChessToAscii(chess));
                Console.Write("> ");
                string move = Console.ReadLine();
                if (!string.IsNullOrWhiteSpace(move))
                {
                    chess = chess.Move(move);
                }
            }
        }