initial commit

This commit is contained in:
2025-02-25 12:07:16 +01:00
commit 0657bc9b25
34 changed files with 3069 additions and 0 deletions

39
src/Pieces/Generator.h Normal file
View File

@@ -0,0 +1,39 @@
#pragma once
#include "Polyomino.h"
#include <Vector>
#include <Set>
#include <Map>
/**
* A generator of one-sided polyominos of any size
*/
class Generator {
private:
std::vector<Polyomino> validPolyominos; // the list of already generated polyominos
std::set<Cell> currentTestedShape; // the polyomino being created
public:
/**
* Initializes generator
*/
Generator();
/**
* Returns the list of all one-sided polyominos of the specified size
*/
std::vector<Polyomino> generatePolyominos(unsigned int order);
private:
/**
* Generates all one-sided polyominos of the specified using the current tested shape
*/
void generate(unsigned int order, int lastAddedCellNumber, int nextAvaibleNumber, std::map<Cell, int> candidateCells);
/**
* Check wheter a candidate cell can be added to the current tested shape
*/
void tryToAddCandidateCell(const Cell& candidate, int& nextAvaibleNumber, std::map<Cell, int>& candidateCells);
};