public override void DeltaPattern()
        {
            const int index       = (int)EBands.Delta;
            const int attackIndex = 1;
            var       expected    = KnightExpected[index];
            var       actuals     = Bands[index].Select(x => RegAttacks[attackIndex](x).Count);

            actuals.Should().AllBeEquivalentTo(expected);
        }
Beispiel #2
0
        public override void DeltaPattern()
        {
            const int index       = (int)EBands.Delta;
            const int attackIndex = 2;

            foreach (var pieceLocation in Bands[index])
            {
                var attacks = RegAttacks[attackIndex](pieceLocation);
                Assert.Equal(KingExpected[index], attacks.Count);
            }
        }
        public override void DeltaPattern()
        {
            const int index       = (int)EBands.Delta;
            const int attackIndex = 2;
            var       expected    = KingExpected[index];
            var       actuals     = Bands[index].Select(x => RegAttacks[attackIndex](x).Count);

            foreach (var actual in actuals)
            {
                Assert.Equal(expected, actual);
            }
        }
        public override void AlphaPattern()
        {
            const int index       = (int)EBands.Alpha;
            const int attackIndex = 2;

            // special case, as the expected values vary depending on the kings location on the outer rim
            foreach (var pieceLocation in Bands[index])
            {
                var attacks  = RegAttacks[attackIndex](pieceLocation);
                var expected = (BoardCorners & pieceLocation) != 0 ? KingExpected[index] - 2 /* for corners */ : KingExpected[index];
                Assert.Equal(expected, attacks.Count);
            }
        }
        public override void BetaPattern()
        {
            const int   index           = (int)EBands.Beta;
            const int   attackIndex     = 1;
            const ulong narrowLocations = 0x42000000004200;

            foreach (var pieceLocation in Bands[index])
            {
                var attacks  = RegAttacks[attackIndex](pieceLocation);
                var expected = (narrowLocations & pieceLocation) != 0 ? KnightExpected[index] - 2 : KnightExpected[index];
                Assert.Equal(expected, attacks.Count);
            }
        }
        public override void AlphaPattern()
        {
            const int   index           = (int)EBands.Alpha;
            const int   attackIndex     = 1;
            const ulong narrowLocations = 0x4281000000008142;

            foreach (var pieceLocation in Bands[index])
            {
                var attacks  = RegAttacks[attackIndex](pieceLocation);
                var expected = (BoardCorners & pieceLocation) != 0 ? KnightExpected[index] >> 1 /* for corners */ : (narrowLocations & pieceLocation) != 0 ? KnightExpected[index] - 1 /* narrowLocations */ : KnightExpected[index];
                Assert.Equal(expected, attacks.Count);
            }
        }