const everywhere + légèrement changer format fichiers
This commit is contained in:
@@ -27,7 +27,7 @@ Polyomino::Polyomino(const std::set<Position>& positions) {
|
||||
for (Position position : positions) {
|
||||
newPositions.insert(Position{position.x - minX, position.y - minY});
|
||||
}
|
||||
this->positions = newPositions;
|
||||
this->positions = std::move(newPositions);
|
||||
|
||||
// set polyomino length
|
||||
this->length = std::max(maxX - minX + 1, maxY - minY + 1);
|
||||
@@ -52,7 +52,7 @@ void Polyomino::normalize() {
|
||||
for (Position position : this->positions) {
|
||||
newPositions.insert(Position{position.x - minX, position.y - minY});
|
||||
}
|
||||
this->positions = newPositions;
|
||||
this->positions = std::move(newPositions);
|
||||
}
|
||||
|
||||
void Polyomino::rotateCW() {
|
||||
@@ -60,7 +60,7 @@ void Polyomino::rotateCW() {
|
||||
for (Position position : this->positions) {
|
||||
newPositions.insert(Position{position.y, (length - 1) - (position.x)});
|
||||
}
|
||||
this->positions = newPositions;
|
||||
this->positions = std::move(newPositions);
|
||||
}
|
||||
|
||||
void Polyomino::rotate180() {
|
||||
@@ -68,7 +68,7 @@ void Polyomino::rotate180() {
|
||||
for (Position position : this->positions) {
|
||||
newPositions.insert(Position{(length - 1) - (position.x), (length - 1) - (position.y)});
|
||||
}
|
||||
this->positions = newPositions;
|
||||
this->positions = std::move(newPositions);
|
||||
}
|
||||
|
||||
void Polyomino::rotateCCW() {
|
||||
@@ -76,7 +76,7 @@ void Polyomino::rotateCCW() {
|
||||
for (Position position : this->positions) {
|
||||
newPositions.insert(Position{(length - 1) - (position.y), position.x});
|
||||
}
|
||||
this->positions = newPositions;
|
||||
this->positions = std::move(newPositions);
|
||||
}
|
||||
|
||||
void Polyomino::goToSpawnPosition() {
|
||||
@@ -169,7 +169,7 @@ void Polyomino::goToSpawnPosition() {
|
||||
for (Position position : positions) {
|
||||
newPositions.insert(Position{(position.x - minX) + (verticalEmptyLines / 2), (position.y - minY) + ((horizontalEmptyLines + 1) / 2)});
|
||||
}
|
||||
this->positions = newPositions;
|
||||
this->positions = std::move(newPositions);
|
||||
}
|
||||
|
||||
void Polyomino::checkForFlattestSide(const std::vector<std::vector<int>>& linesCompleteness, bool currentFlattestSides[4], int& sideToBeOn, bool checkLeftSide) const {
|
||||
@@ -285,9 +285,9 @@ bool Polyomino::operator<(const Polyomino& other) const {
|
||||
// we check for all positions from left to right and top to bottom, until one has a square that the other doesn't
|
||||
for (int y = this->length - 1; y >= 0; y--) {
|
||||
for (int x = 0; x < this->length; x++) {
|
||||
bool hasThisposition = this->positions.contains(Position{x, y});
|
||||
bool hasOtherposition = other.positions.contains(Position{x, y});
|
||||
if (hasThisposition != hasOtherposition) return hasThisposition;
|
||||
bool hasThisPosition = this->positions.contains(Position{x, y});
|
||||
bool hasOtherPosition = other.positions.contains(Position{x, y});
|
||||
if (hasThisPosition != hasOtherPosition) return hasThisPosition;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user