コード例 #1
0
ファイル: Board.cs プロジェクト: gwalton2/MilseyEngine
        public void MoveBitBoard(int og_index, int new_index)
        {
            ulong move      = Moves.GetMoveBitboard(og_index, new_index);
            ulong new_spot  = (ulong)0x1 << new_index;
            ulong old_spot  = (ulong)0x1 << og_index;
            ulong enpassant = Moves.GetEnPassant(new_index, chessboard);

            ulong[] castle = Moves.GetCastle(og_index, new_index, chessboard);

            List <ulong> boardList = chessboard.BoardList();

            for (int i = 0; i < boardList.Count; i++)
            {
                if ((boardList[i] ^ new_spot) < boardList[i])
                {
                    boardList[i] ^= new_spot;
                }
                else if ((boardList[i] ^ enpassant) < boardList[i])
                {
                    boardList[i] ^= enpassant;
                }
                else if ((boardList[i] ^ castle[1]) < boardList[i])
                {
                    boardList[i] ^= (castle[0] | castle[1]);
                    _castle       = castle;
                }
                else if ((boardList[i] ^ old_spot) < boardList[i])
                {
                    boardList[i] ^= move;
                    boardList.Add(Moves.SetEnPassant(i, og_index, new_index));
                }
            }
            chessboard.MakeMove(boardList);
            game.NextTurn();
        }