partially_filled) : height(height), width(width) { board = std::vector<std::vector<Cell>>(); for (int i = 0; i < height; ++i) { board.push_back(std::vector<Cell>(width)); //les element sont initialisés par le constructeur par défaut de Cell } if(partially_filled) partiallyFill(); }
const bool Board::isPositionOccupied(const Position &pos) const{
if (pos.x() >= 0 && pos.x() < height && pos.y() >= 0 && pos.y() < width) { return board[pos.x()][pos.y()].isOccupiedCell(); } else { throw std::out_of_range("Position is outside the board bounds."); } } const bool Board::isPositionCurrent(const Position &pos)const{ if (pos.x() >= 0 && pos.x() < height && pos.y() >= 0 && pos.y() < width) { return board[pos.x()][pos.y()].isCurrentBrickCell(); } else { throw std::out_of_range("Position is outside the board bounds."); } }