dispatcher-a1 now functional
a1 Solver finds solutions for puzzles, dispatcher correctly distributes layers.
This commit is contained in:
parent
6754873cfd
commit
c0f0417d3b
@ -32,7 +32,7 @@ void Puzzle::putIntoBox()
|
||||
for(int j=0;j<this->getSizeAsCoor().row;j++)
|
||||
{
|
||||
|
||||
tmpPart.m_a1=this->a1.m_constraintMatrix[i][j];
|
||||
tmpPart.m_a1=this->a1.m_constraintMatrix[i+1][j+1];
|
||||
//sets part id
|
||||
tmpPart.SetPartID(id++);
|
||||
// adds all 4 rotations to Box
|
||||
|
@ -9,7 +9,8 @@ bool next(vector<LogEntry>& log,Puzzle& puzzleMat)
|
||||
{
|
||||
//last log element is set, create new log element or log not yet started
|
||||
if(!(log.size()) || log.back().isSet())
|
||||
if((puzzleMat.allSet())) return false; //puzzle solved
|
||||
if((puzzleMat.allSet()))
|
||||
return false; //puzzle solved
|
||||
else createNextLogElement(log,puzzleMat);
|
||||
|
||||
//last log element is empty, backtrack
|
||||
@ -116,10 +117,12 @@ bool backtrack(vector<LogEntry>& log, Puzzle& puzzleMat)
|
||||
return false;
|
||||
}
|
||||
puzzleMat.combinedQualityVector.clear(); //remove all data from temp quality save
|
||||
//if more pieces possible, take next piece
|
||||
//if more pieces possible, tset piece as not logged
|
||||
if((log.back().PieceCollector.size())>1)
|
||||
{
|
||||
puzzleMat.p_myBox.push_back(log.back().PieceCollector.begin()->second);
|
||||
for(int i=0;i<puzzleMat.p_myBox.size();i++)
|
||||
if(puzzleMat.p_myBox[i]->GetPartID()==log.back().PieceCollector.begin()->second->GetPartID())//sets all with partid
|
||||
puzzleMat.p_myBox[i]->set=false;
|
||||
log.back().PieceCollector.erase(log.back().PieceCollector.begin());
|
||||
|
||||
if(log.back().PieceCollector.size()==1)
|
||||
|
@ -5,7 +5,7 @@ int LogEntry::randomed(0);
|
||||
int main()
|
||||
{
|
||||
|
||||
unsigned int cols=6,rows=8;
|
||||
unsigned int cols=9,rows=8;
|
||||
|
||||
vector<LogEntry> log;
|
||||
Puzzle puzzleMat(cols, rows);
|
||||
|
Loading…
Reference in New Issue
Block a user