Example #1
0
        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();
        }
Example #2
0
        public void MoveCharEnpassant(int new_index)
        {
            ulong enpassant = Moves.GetEnPassant(new_index, chessboard);

            if (enpassant != 0)
            {
                int enp_index = Moves.ConvertBitboard(enpassant)[0];
                int enp_rank  = enp_index / 8;
                int enp_file  = enp_index % 8;
                _myboard[enp_rank, enp_file] = '-';

                _captured = true;
            }
        }