bhlangonijr / chesslib

chess library for legal move generation, FEN/PGN parsing and more
Apache License 2.0
229 stars 80 forks source link

BitBoard.hasOnly1Bit() does not consider square h8 as the only marked square #116

Closed johu56 closed 1 month ago

johu56 commented 2 months ago

In the method shoud something as following inserted (sorry, I'm not able to make a pull request)

if (bb < 0L) {
    return (bb==0X8000000000000000L);
}
bhlangonijr commented 1 month ago

Precisely, good call. To simplify it I am going to modify the function to:

public static boolean hasOnly1Bit(Long bb) {
        return bb != 0L && extractLsb(bb) == 0L;
    }