Optimize pieces generation #6

Merged
julien merged 10 commits from opti into main 2026-02-02 17:35:42 +00:00
Showing only changes of commit de63cd22b6 - Show all commits

View File

@@ -78,15 +78,8 @@ void Polyomino::rotateCCW() {
void Polyomino::goToSpawnPosition() {
// initialize array
std::vector<std::vector<int>> linesCompleteness;
linesCompleteness.reserve(4);
std::vector<int> empty;
for (int j = 0; j < this->length; j++) {
empty.push_back(0);
}
for (int i = 0; i < 4; i++) {
linesCompleteness.push_back(empty);
}
std::vector<int> empty(this->length, 0);
std::vector<std::vector<int>> linesCompleteness(4, empty);
// calculates amount of squares per rows and columns
for (const Position position : *this) {