allow resetting games

This commit is contained in:
2025-03-01 19:13:49 +01:00
parent 03281a6d70
commit d443b25de1
10 changed files with 97 additions and 14 deletions

View File

@@ -16,10 +16,25 @@ GameBoard::GameBoard(int boardWidth, int boardHeight, const std::shared_ptr<Piec
generator(pieceList),
nextQueueLength(nextQueueLength) {
this->initialize();
}
void GameBoard::reset() {
this->board.clearBoard();
this->generator.jumpToNextBag();
this->initialize();
}
void GameBoard::initialize() {
this->nextQueue.clear();
for (int i = 0; i < nextQueueLength; i++) {
this->nextQueue.push_back(this->generator.getNext());
}
this->activePiece = nullptr;
this->heldPiece = nullptr;
this->isLastMoveKick = false;
}
bool GameBoard::moveLeft() {