Skip to content

Commit

Permalink
wrote move result function
Browse files Browse the repository at this point in the history
  • Loading branch information
mbluemer committed Apr 18, 2017
1 parent 72a0ec8 commit d858eb0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
7 changes: 3 additions & 4 deletions include/BitBoard.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ class BitBoard
static const uint32_t blackKingSpots = 0x82000820;

/* Class member variables */
const uint32_t m_blackPieces = 0x41C71C3;
const uint32_t m_whitePieces = 0xE3820C38;
const uint32_t m_kings = 0;
uint32_t m_blackPieces = 0x41C71C3;
uint32_t m_whitePieces = 0xE3820C38;
uint32_t m_kings = 0;

bool m_isBlacksTurn = true;


// static constexpr uint32_t rowMask[8];
/* Class member functions */

Expand Down
1 change: 1 addition & 0 deletions include/Move.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Move
void removeLast();
bool isEmpty();
int length();
std::vector<int> getMoves() { return moves; }
};

#endif
14 changes: 14 additions & 0 deletions src/BitBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,17 @@ std::vector<Move> const BitBoard::actions()

return moves;
}

BitBoard const BitBoard::result(Move move) {
BitBoard currBoard = *this;
int start;
for (int x : move.getMoves()) {
if (!start) {
start = x;
} else {
currBoard = boardMove(currBoard, 1<<start, 1<<x);
start = x;
}
}
return currBoard;
}

0 comments on commit d858eb0

Please sign in to comment.