예제 #1
0
        /// <summary>
        /// Some colour acrobatics
        /// </summary>
        /// <param name="board"></param>
        static public void Board(Board board)
        {
            int index;
            ConsoleColor tempColour;

            Console.BackgroundColor = ConsoleColor.Gray;
            for (int i = 8; i >= 1; i--)
            {
                tempColour = Console.BackgroundColor;
                Console.BackgroundColor = ConsoleColor.Black;
                Console.ForegroundColor = ConsoleColor.Gray;
                Console.Write(i + " ");
                Console.BackgroundColor = tempColour;

                for (int j = 1; j <= 8; j++)
                {
                    index = Definitions.GetIndex(i, j);
                    if (board.ColourArray[index] == Definitions.WHITE)
                        Console.ForegroundColor = ConsoleColor.White;
                    else if (board.ColourArray[index] == Definitions.BLACK)
                        Console.ForegroundColor = ConsoleColor.Black;

                    Console.Write(" " + Definitions.PieceValueToString[board.PieceArray[index]]);

                    if (Console.BackgroundColor == ConsoleColor.Gray)
                        Console.BackgroundColor = ConsoleColor.DarkGray;
                    else
                        Console.BackgroundColor = ConsoleColor.Gray;
                }

                if (Console.BackgroundColor == ConsoleColor.Gray)
                    Console.BackgroundColor = ConsoleColor.DarkGray;
                else
                    Console.BackgroundColor = ConsoleColor.Gray;
                Console.WriteLine();
            }
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.BackgroundColor = ConsoleColor.Black;

            Console.WriteLine("   A B C D E F G H\n");
            Console.WriteLine("Castling value:       " + board.Castling);
            Console.WriteLine("En passant target:    " + board.EnPassantTarget);
            Console.WriteLine("Full move number:     " + board.FullMoveNumber);
            Console.WriteLine("Half move clock:      " + board.HalfMoveClock);
            Console.WriteLine("Turn to move:         " + TurnText(board.Turn));
            Console.WriteLine("Current board value:  " + Eval.Board(board));
        }
예제 #2
0
파일: Board.cs 프로젝트: freemanirl/fiasco
		/// <summary>
		/// Full copy constructor
		/// </summary>
		/// <param name="board">Board to be copied</param>
        public Board(Board board)
        {
            System.Array.Copy(board.PieceArray, this.PieceArray, 120);
            System.Array.Copy(board.ColourArray, this.ColourArray, 120);

            this.Turn = board.Turn;
            this.Castling = board.Castling;
            this.EnPassantTarget = board.EnPassantTarget;
            this.HalfMoveClock = board.HalfMoveClock;
            this.FullMoveNumber = board.FullMoveNumber;
            this.Book = board.Book;
            this.History = board.History;
            this.WhiteKing = board.WhiteKing;
            this.BlackKing = board.BlackKing;
            this.ZobristHash = board.ZobristHash;
            this.HashValues = board.HashValues;
        }
예제 #3
0
        private static void GenerateAttackBoard(int direction)
        {
            for (int row = 1; row <= 8; row++)
            {
                for (int column = 1; column <= 8; column++)
                {
                    Board board = new Board("8/8/8/8/8/8/8/8 w - - 0 1");
                    board.PieceArray[Definitions.GetIndex(row, column)] = direction;
                    board.ColourArray[Definitions.GetIndex(row, column)] = Definitions.WHITE;

                    List<Move> moves = board.GenerateMoves();

                    ulong resultant = 0;

                    foreach (Move move in moves)
                    {
                        int piece = PiecePower(move.To);
                        resultant += P2(piece);
                    }

                    Console.Write(resultant + ", ");
                    if (column % 4 == 0)
                        Console.WriteLine("");
                }

            }
        }
예제 #4
0
파일: Perft.cs 프로젝트: freemanirl/fiasco
 public void Init()
 {
     board = new Board();
 }