Exemplo n.º 1
0
        private static ulong GetPatternForField(int color, int fieldIndex)
        {
            var offset       = color == Color.White ? 8 : -8;
            var currentField = fieldIndex + 2 * offset;
            var result       = 0ul;

            while (currentField >= 0 && currentField < 64)
            {
                result       |= BoxPatternGenerator.GetPattern(currentField);
                currentField += offset;
            }

            return(result);
        }
Exemplo n.º 2
0
        private static ulong GetPatternForField(int color, int fieldIndex)
        {
            var offset = color == Color.White ? 8 : -8;
            var mask   = BoxPatternGenerator.GetPattern(fieldIndex);
            var fieldIndexWithOffset = fieldIndex + offset;

            if (fieldIndexWithOffset >= 0 && fieldIndexWithOffset < 64)
            {
                mask |= BoxPatternGenerator.GetPattern(fieldIndexWithOffset);
                mask &= ~(1ul << fieldIndex);
            }

            return(mask);
        }
Exemplo n.º 3
0
 private static ulong GetPatternForField(int fieldIndex)
 {
     return(DiagonalPatternGenerator.GetPattern(fieldIndex) & BoxPatternGenerator.GetPattern(fieldIndex));
 }