mis en place la PR de simon sur les couleurs

This commit is contained in:
2025-02-28 18:42:04 +01:00
parent f0f391ade6
commit 26f501f7e8
29 changed files with 713 additions and 665 deletions

View File

@@ -2,9 +2,10 @@
#include "Polyomino.h"
#include "Rotation.h"
#include "Block.h"
#include "Color.h"
#include <Set>
#include <set>
/**
@@ -13,13 +14,13 @@
class Piece {
private:
Polyomino polyomino; // a polyomino representing the piece, (0, 0) is downleft
Color color; // the color of the piece
Block blockType; // the block type of the piece
public:
/**
* Creates a piece with a specified shape and color
* Creates a piece with a specified shape and block type
*/
Piece(const Polyomino& piece, Color color);
Piece(const Polyomino& piece, Block blockType);
/**
* Rotates the piece in the specified direction
@@ -27,22 +28,23 @@ class Piece {
void rotate(Rotation rotation);
/**
* Returns a copy of the list of cells of the piece
* @return A copy of the list of positions of the piece
*/
std::set<Cell> getPositions() const;
std::set<Position> getPositions() const;
/**
* Returns the length of the piece
* @return The length of the piece
*/
int getLength() const;
/**
* Returns the color of the piece
* @return The block type of the piece
*/
Color getColor() const;
Block getBlockType() const;
/**
* Stream output operator, adds a 2D grid representing the piece
* @return A reference to the output stream
*/
friend std::ostream& operator<<(std::ostream& os, const Piece& piece);
};