Ejemplo n.º 1
0
        /*
         * West                Nort                 NoWe                NoEa
         * . . . . . . . .     . . . 1 . . . .      . . . . . . . .     . . . . . . . 1
         * . . . . . . . .     . . . 1 . . . .      1 . . . . . . .     . . . . . . 1 .
         * . . . . . . . .     . . . 1 . . . .      . 1 . . . . . .     . . . . . 1 . .
         * . . . . . . . .     . . . 1 . . . .      . . 1 . . . . .     . . . . 1 . . .
         * 1 1 1 R . . . .     . . . R . . . .      . . . B . . . .     . . . B . . . .
         * . . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .
         * . . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .
         * . . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .
         */
        private static UInt64 getNegativeRayAttacks(UInt64 occupied, int rayDir, byte square)
        {
            UInt64 attacks = rayAttacks[rayDir, square];
            UInt64 blocker = attacks & occupied;

            if (blocker != 0UL)
            {
                square   = BitOps.bitScanReverse(blocker);
                attacks ^= rayAttacks[rayDir, square];
            }
            return(attacks);
        }