diff --git a/Source/functions/solve/puzzleExtension.cpp b/Source/functions/solve/puzzleExtension.cpp index 5906441..e46999c 100644 --- a/Source/functions/solve/puzzleExtension.cpp +++ b/Source/functions/solve/puzzleExtension.cpp @@ -32,7 +32,7 @@ void Puzzle::putIntoBox() for(int j=0;jgetSizeAsCoor().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 diff --git a/Source/functions/solve/structure.cpp b/Source/functions/solve/structure.cpp index 71e521e..8a21627 100755 --- a/Source/functions/solve/structure.cpp +++ b/Source/functions/solve/structure.cpp @@ -9,7 +9,8 @@ bool next(vector& 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& 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;iGetPartID()==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) diff --git a/Source/main.cpp b/Source/main.cpp index 661a56a..3472ac5 100644 --- a/Source/main.cpp +++ b/Source/main.cpp @@ -5,7 +5,7 @@ int LogEntry::randomed(0); int main() { - unsigned int cols=6,rows=8; + unsigned int cols=9,rows=8; vector log; Puzzle puzzleMat(cols, rows);