public void WhitePawns_E4_D3F3() { // arrange var a = new AttackMasks(new Square("E4")); Bitboard expected = Bitboard.With.D3.F3.Build(); // act Bitboard result = a.WhitePawns; // assert result.Should().Be(expected); }
public void BlackPawns_E4_D5F5() { // arrange var a = new AttackMasks(new Square("E4")); Bitboard expected = Bitboard.With.D5.F5.Build(); // act Bitboard result = a.BlackPawns; // assert result.Should().Be(expected); }
public Bitboard AttackedFrom(Side white, Side black) { var allpieces = white.Occupation | black.Occupation; var attackMasks = new AttackMasks(this); Bitboard result = (white.Pawns.Locations & attackMasks.WhitePawns) | (black.Pawns.Locations & attackMasks.BlackPawns); result |= (attackMasks.Knights & (white.Knights.Locations | black.Knights.Locations)); Bitboard bsliders = (white.Bishops.Locations | black.Bishops.Locations | white.Queens.Locations | black.Queens.Locations) & attackMasks.Bishops; Bitboard rsliders = (white.Rooks.Locations | black.Rooks.Locations | white.Queens.Locations | black.Queens.Locations) & attackMasks.Rooks; if (bsliders != Bitboard.Empty) result |= (bsliders & Moveboard.Get<Bishop>(this, Bitboard.Empty, allpieces)); if (rsliders != Bitboard.Empty) result |= (rsliders & Moveboard.Get<Rook>(this, Bitboard.Empty, allpieces)); return result; }