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 - movegenerator.cpp

movegenerator.cpp

Caricato da: Crybot
Scarica il programma completo

  1. #include "movegenerator.h"
  2. #include "queen.h"
  3.  
  4. namespace Napoleon
  5. {
  6.     void MoveGenerator::GetQueenMoves(BitBoard queens, Board &board, Move moveList[], int &pos, BitBoard target)
  7.     {
  8.         BitBoard targets;
  9.         Square fromIndex;
  10.         Square toIndex;
  11.  
  12.         while (queens != 0)
  13.         {
  14.             fromIndex = Utils::BitBoard::BitScanForwardReset(queens); // search for LS1B and then reset it
  15.             targets = Queen::GetAllTargets(Constants::Masks::SquareMask[fromIndex], board) & target;
  16.  
  17.             while (targets != 0)
  18.             {
  19.                 toIndex = Utils::BitBoard::BitScanForwardReset(targets); // search for LS1B and then reset it
  20.                 moveList[pos++] =  Move(fromIndex, toIndex);
  21.             }
  22.         }
  23.     }
  24. }