Pseudo legal movegen #1

Closed
rektdie wants to merge 6 commits from pseudoLegalMovegen into legalMovegen
pull from: pseudoLegalMovegen
4 changed files with 12 additions and 8 deletions
Showing only changes of commit f6c2b6a881 - Show all commits

No files matched your search

+2 -2
View File
@@ -17,10 +17,10 @@ OBJS := $(addprefix $(OBJ_DIR)/, $(notdir $(SRCS:.cpp=.o)))
# Target executable
Eleanor$(EXE_EXT): $(OBJS)
g++ -o $@ $^
g++ -o $@ $^ -O3
# Rule to compile source files to object files
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp $(SRC_DIR)/types.h | $(OBJ_DIR)
g++ -c -o $@ $<
g++ -c -o $@ $< -O3
# Create the object directory if it doesn't exist
$(OBJ_DIR):
+3 -3
View File
@@ -28,15 +28,15 @@ U64 Bitboard::GetBoard() const {
}
bool Bitboard::IsSet(int square) const {
return (1ULL << square) & m_board;
return GetSquare(square).GetBoard() & m_board;
}
void Bitboard::SetBit(int square) {
m_board |= (1ULL << square);
m_board |= GetSquare(square).GetBoard();
}
void Bitboard::PopBit(int square) {
m_board &= ~(1ULL << square);
m_board &= ~GetSquare(square).GetBoard();
}
int Bitboard::PopCount() const {
+4
View File
@@ -22,6 +22,10 @@ public:
int getLS1BIndex() const;
static Bitboard getOccupancy(int index, Bitboard attackMask);
static Bitboard GetSquare(int square) {
return (1ULL << square);
};
Bitboard operator&(const Bitboard& other) const;
Bitboard operator|(const Bitboard& other) const;
Bitboard operator^(const Bitboard& other) const;
+3 -3
View File
@@ -18,7 +18,7 @@ static Bitboard notHGfile = notHfile & ~files[G];
Bitboard maskPawnAttacks(int side, int square) {
Bitboard attacks;
Bitboard attacker = (1ULL << square);
Bitboard attacker = Bitboard::GetSquare(square);
// White
if (!side) {
@@ -35,7 +35,7 @@ Bitboard maskPawnAttacks(int side, int square) {
Bitboard maskKnightAttacks(int square) {
Bitboard attacks;
Bitboard attacker = (1ULL << square);
Bitboard attacker = Bitboard::GetSquare(square);
if (((attacker << noEa + north) & notAfile).GetBoard()) attacks |= (attacker << noEa + north);
if (((attacker << noWe + north) & notHfile).GetBoard()) attacks |= (attacker << noWe + north);
@@ -52,7 +52,7 @@ Bitboard maskKnightAttacks(int square) {
Bitboard maskKingAttacks(int square) {
Bitboard attacks;
Bitboard attacker = (1ULL << square);
Bitboard attacker = Bitboard::GetSquare(square);
attacks |= (attacker << north);
attacks |= (attacker << south);