#pragma once #include "Polyomino.h" #include #include #include /** * A generator of one-sided polyominoes of any size */ class Generator { private: std::vector validPolyominoes; // the list of already generated polyominoes std::set currentTestedShape; // the polyomino being created public: /** * Default constructor */ Generator(); /** * Generates the list of all one-sided polyominoes of the specified size * @return The list of polyominoes */ std::vector generatePolyominoes(int polyominoSize); private: /** * Generates all one-sided polyominoes of the specified size using the current tested shape */ void generate(int polyominoSize, int lastAddedPositionNumber, int nextAvaibleNumber, std::map candidatePositions); /** * Checks wheter a candidate position can be added to the current tested shape */ void tryToAddCandidatePosition(const Position& candidate, int& nextAvaibleNumber, std::map& candidatePositions); };