Exemple #1
0
 public function shift_l_($num)
 {
     $bb = new BitBoard();
     $bb->num1 = $this->num1;
     $bb->num2 = $this->num2;
     $bb->num3 = $this->num3;
     $bb->num4 = $this->num4;
     $bb->shift_l($num);
     return $bb;
 }
 private function Board_AddPiece($nCol, $nRow, $pieceType)
 {
     // A piece gets added to the bitboard for its specific type as well as to the overall white/black bitboard.
     $pos = new BitBoard('0x1');
     $pos->shift_l($nCol + $nRow * 8);
     switch ($pieceType) {
         case PIECE_TYPE::PAWN:
             $this->n64WPawns->_OR($pos);
             $this->n64WAll->_OR($pos);
             break;
         case PIECE_TYPE::ROOK:
             $this->n64WRooks->_OR($pos);
             $this->n64WAll->_OR($pos);
             break;
         case PIECE_TYPE::KNIGHT:
             $this->n64WKnights->_OR($pos);
             $this->n64WAll->_OR($pos);
             break;
         case PIECE_TYPE::BISHOP:
             $this->n64WBishops->_OR($pos);
             $this->n64WAll->_OR($pos);
             break;
         case PIECE_TYPE::QUEEN:
             $this->n64WQueens->_OR($pos);
             $this->n64WAll->_OR($pos);
             break;
         case PIECE_TYPE::KING:
             $this->n64WKing->_OR($pos);
             $this->n64WAll->_OR($pos);
             break;
         case PIECE_TYPE::PAWN + 6:
             $this->n64BPawns->_OR($pos);
             $this->n64BAll->_OR($pos);
             break;
         case PIECE_TYPE::ROOK + 6:
             $this->n64BRooks->_OR($pos);
             $this->n64BAll->_OR($pos);
             break;
         case PIECE_TYPE::KNIGHT + 6:
             $this->n64BKnights->_OR($pos);
             $this->n64BAll->_OR($pos);
             break;
         case PIECE_TYPE::BISHOP + 6:
             $this->n64BBishops->_OR($pos);
             $this->n64BAll->_OR($pos);
             break;
         case PIECE_TYPE::QUEEN + 6:
             $this->n64BQueens->_OR($pos);
             $this->n64BAll->_OR($pos);
             break;
         case PIECE_TYPE::KING + 6:
             $this->n64BKing->_OR($pos);
             $this->n64BAll->_OR($pos);
             break;
     }
     $this->n64All = BitBoard::_OR_($this->n64BAll, $this->n64WAll);
 }