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,7 +2,7 @@
#include "../Pieces/Piece.h"
#include <Vector>
#include <vector>
#include <iostream>
@@ -11,9 +11,9 @@
*/
class Board {
private:
std::vector<std::vector<Color>> grid; // the grid, (0,0) is downleft
int width; // the width of the grid
int height; // the base height of the grid, which can extends indefinitely
std::vector<std::vector<Block>> grid; // the grid, (0,0) is downleft
int width; // the width of the grid
int height; // the base height of the grid, which can extends indefinitely
public:
/**
@@ -22,42 +22,44 @@ class Board {
Board(int width, int height);
/**
* Change the color of the specified block, if the block is out of bounds it is simply ignored
* Change the block of the specified block, if the block is out of bounds it is simply ignored
*/
void addBlock(const Cell& position, Color block);
void addBlock(const Position& position, Block block);
/**
* Clears any complete row and moves down the rows on top, returns the number of cleared rows
* Clears any complete row and moves down the rows on top
* @return The number of cleared rows
*/
int clearRows();
/**
* Returns the color of the block at the specified position
* @return The block of the block at the specified position
*/
Color getBlock(const Cell& position) const;
Block getBlock(const Position& position) const;
/**
* Returns a copy of the grid
* @return A copy of the grid
*/
std::vector<std::vector<Color>> getBlocks() const;
std::vector<std::vector<Block>> getBlocks() const;
/**
* Returns the actual height of the grid
* @return The actual height of the grid
*/
int getGridHeight() const;
/**
* Returns the base height of the grid
* @return The base height of the grid
*/
int getBaseHeight() const;
/**
* Returns the width of the grid
* @return The width of the grid
*/
int getWidth() const;
/**
* Stream output operator, adds a 2D grid representing the board
* @return A reference to the output stream
*/
friend std::ostream& operator<<(std::ostream& os, const Board& board);
};