Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Napoleon - bishop.h

bishop.h

Caricato da: Crybot
Scarica il programma completo

  1. #ifndef BISHOP_H
  2. #define BISHOP_H
  3. #include "defines.h"
  4. #include "board.h"
  5. #include "utils.h"
  6. #include "movedatabase.h"
  7.  
  8. namespace Napoleon
  9. {
  10.     class Bishop
  11.     {
  12.     public:
  13.         static BitBoard GetAllTargets(BitBoard, Board&);
  14.  
  15.     };
  16.  
  17.     INLINE BitBoard Bishop::GetAllTargets(BitBoard bishops, Board& board)
  18.     {
  19.         BitBoard occupiedSquares = board.OccupiedSquares;
  20.         BitBoard targets = Constants::Empty;
  21.  
  22.         Square square = Utils::BitBoard::BitScanForward(bishops);
  23.  
  24.         targets |= MoveDatabase::GetA1H8DiagonalAttacks(occupiedSquares, square);
  25.         targets |= MoveDatabase::GetH1A8DiagonalAttacks(occupiedSquares, square);
  26.  
  27.         return targets & ~board.GetPlayerPieces();
  28.     }
  29. }
  30.  
  31. #endif // BISHOP_H