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 - compassrose.h

compassrose.h

Caricato da: Crybot
Scarica il programma completo

  1. #ifndef COMPASSROSE_H
  2. #define COMPASSROSE_H
  3. #include "constants.h"
  4.  
  5. namespace Napoleon
  6. {
  7.     namespace CompassRose
  8.     {
  9.         /*      northwest    north   northeast
  10.                 noWe         nort         noEa
  11.                         +7    +8    +9
  12.                             \  |  /
  13.                 west    -1 <-  0 -> +1    east
  14.                             /  |  \
  15.                         -9    -8    -7
  16.                 soWe         sout         soEa
  17.                 southwest    south   southeast
  18.         */
  19.  
  20.         INLINE BitBoard OneStepSouth(BitBoard bitBoard) { return bitBoard >> 8; }
  21.         INLINE BitBoard OneStepNorth(BitBoard bitBoard) { return bitBoard << 8; }
  22.         INLINE BitBoard OneStepWest(BitBoard bitBoard) { return bitBoard >> 1 & Constants::NotHFile; }
  23.         INLINE BitBoard OneStepEast(BitBoard bitBoard) { return bitBoard << 1 & Constants::NotAFile; }
  24.  
  25.         INLINE BitBoard OneStepNorthEast(BitBoard bitBoard) { return bitBoard << 9 & Constants::NotAFile; }
  26.         INLINE BitBoard OneStepNorthWest(BitBoard bitBoard) { return bitBoard << 7 & Constants::NotHFile; }
  27.         INLINE BitBoard OneStepSouthEast(BitBoard bitBoard) { return bitBoard >> 7 & Constants::NotAFile; }
  28.         INLINE BitBoard OneStepSouthWest(BitBoard bitBoard) { return bitBoard >> 9 & Constants::NotHFile; }
  29.     }
  30. }
  31.  
  32. #endif // COMPASSROSE_H