initial commit
This commit is contained in:
39
src/Pieces/Generator.h
Normal file
39
src/Pieces/Generator.h
Normal 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);
|
||||
};
|
||||
Reference in New Issue
Block a user