ajouté interface textuelle

This commit is contained in:
2025-03-02 23:36:20 +01:00
parent 857f90d646
commit 1033f3a64c
21 changed files with 646 additions and 113 deletions

View File

@@ -12,6 +12,8 @@
Piece::Piece(const Polyomino& polyomino, Block blockType) :
polyomino(polyomino),
blockType(blockType) {
this->rotationState = NONE;
}
void Piece::rotate(Rotation rotation) {
@@ -21,9 +23,22 @@ void Piece::rotate(Rotation rotation) {
this->polyomino.rotate180();
if (rotation == COUNTERCLOCKWISE)
this->polyomino.rotateCCW();
this->rotationState += rotation;
}
std::set<Position> Piece::getPositions() const {
void Piece::defaultRotation() {
if (this->rotationState == CLOCKWISE)
this->polyomino.rotateCCW();
if (this->rotationState == DOUBLE)
this->polyomino.rotate180();
if (this->rotationState == COUNTERCLOCKWISE)
this->polyomino.rotateCW();
this->rotationState = NONE;
}
const std::set<Position>& Piece::getPositions() const {
return this->polyomino.getPositions();
}