Beispiel #1
0
 private static UInt64 GetEastAttacks(bool isPlayer, UInt64 pawns)
 {
     if (isPlayer)
     {
         return(BitOps.OneStepNorthEast(pawns));
     }
     else
     {
         return(BitOps.OneStepSouthEast(pawns));
     }
 }
Beispiel #2
0
        public static void initRayAttacks()
        {
            UInt64 rayAttack;

            for (byte i = 0; i < 64; i++)
            {
                UInt64 square = 1UL << i;

                //nort
                rayAttack        = BitOps.OneStepNorth(square);
                rayAttack       |= BitOps.OneStepNorth(rayAttack);
                rayAttack       |= BitOps.OneStepNorth(rayAttack);
                rayAttack       |= BitOps.OneStepNorth(rayAttack);
                rayAttack       |= BitOps.OneStepNorth(rayAttack);
                rayAttack       |= BitOps.OneStepNorth(rayAttack);
                rayAttack       |= BitOps.OneStepNorth(rayAttack);
                rayAttacks[0, i] = rayAttack;

                //sout
                rayAttack        = BitOps.OneStepSouth(square);
                rayAttack       |= BitOps.OneStepSouth(rayAttack);
                rayAttack       |= BitOps.OneStepSouth(rayAttack);
                rayAttack       |= BitOps.OneStepSouth(rayAttack);
                rayAttack       |= BitOps.OneStepSouth(rayAttack);
                rayAttack       |= BitOps.OneStepSouth(rayAttack);
                rayAttack       |= BitOps.OneStepSouth(rayAttack);
                rayAttacks[1, i] = rayAttack;

                //east
                rayAttack        = BitOps.OneStepEast(square);
                rayAttack       |= BitOps.OneStepEast(rayAttack);
                rayAttack       |= BitOps.OneStepEast(rayAttack);
                rayAttack       |= BitOps.OneStepEast(rayAttack);
                rayAttack       |= BitOps.OneStepEast(rayAttack);
                rayAttack       |= BitOps.OneStepEast(rayAttack);
                rayAttack       |= BitOps.OneStepEast(rayAttack);
                rayAttacks[2, i] = rayAttack;

                //west
                rayAttack        = BitOps.OneStepWest(square);
                rayAttack       |= BitOps.OneStepWest(rayAttack);
                rayAttack       |= BitOps.OneStepWest(rayAttack);
                rayAttack       |= BitOps.OneStepWest(rayAttack);
                rayAttack       |= BitOps.OneStepWest(rayAttack);
                rayAttack       |= BitOps.OneStepWest(rayAttack);
                rayAttack       |= BitOps.OneStepWest(rayAttack);
                rayAttacks[3, i] = rayAttack;

                //noEa
                rayAttack        = BitOps.OneStepNorthEast(square);
                rayAttack       |= BitOps.OneStepNorthEast(rayAttack);
                rayAttack       |= BitOps.OneStepNorthEast(rayAttack);
                rayAttack       |= BitOps.OneStepNorthEast(rayAttack);
                rayAttack       |= BitOps.OneStepNorthEast(rayAttack);
                rayAttack       |= BitOps.OneStepNorthEast(rayAttack);
                rayAttack       |= BitOps.OneStepNorthEast(rayAttack);
                rayAttacks[4, i] = rayAttack;

                //soWe
                rayAttack        = BitOps.OneStepSouthWest(square);
                rayAttack       |= BitOps.OneStepSouthWest(rayAttack);
                rayAttack       |= BitOps.OneStepSouthWest(rayAttack);
                rayAttack       |= BitOps.OneStepSouthWest(rayAttack);
                rayAttack       |= BitOps.OneStepSouthWest(rayAttack);
                rayAttack       |= BitOps.OneStepSouthWest(rayAttack);
                rayAttack       |= BitOps.OneStepSouthWest(rayAttack);
                rayAttacks[5, i] = rayAttack;

                //noWe
                rayAttack        = BitOps.OneStepNorthWest(square);
                rayAttack       |= BitOps.OneStepNorthWest(rayAttack);
                rayAttack       |= BitOps.OneStepNorthWest(rayAttack);
                rayAttack       |= BitOps.OneStepNorthWest(rayAttack);
                rayAttack       |= BitOps.OneStepNorthWest(rayAttack);
                rayAttack       |= BitOps.OneStepNorthWest(rayAttack);
                rayAttack       |= BitOps.OneStepNorthWest(rayAttack);
                rayAttacks[6, i] = rayAttack;

                //soEa
                rayAttack        = BitOps.OneStepSouthEast(square);
                rayAttack       |= BitOps.OneStepSouthEast(rayAttack);
                rayAttack       |= BitOps.OneStepSouthEast(rayAttack);
                rayAttack       |= BitOps.OneStepSouthEast(rayAttack);
                rayAttack       |= BitOps.OneStepSouthEast(rayAttack);
                rayAttack       |= BitOps.OneStepSouthEast(rayAttack);
                rayAttack       |= BitOps.OneStepSouthEast(rayAttack);
                rayAttacks[7, i] = rayAttack;
            }
        }