diff --git a/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp b/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp index c9f3880..e524f2c 100644 --- a/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp +++ b/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp @@ -18,7 +18,7 @@ bool AbstractionLayer_1::EvaluateQuality (const coor constraintCoordinate, quali { for(auto it = qVector.begin(); it != qVector.end(); it++) { - if(PlaceOfPartGood(constraintCoordinate, it->first->myLayers->m_test1.m_connections)) + if(PlaceOfPartGood(constraintCoordinate, it->first->m_test1.m_connections)) continue; qVector.erase(it++); } @@ -92,7 +92,7 @@ qualityVector AbstractionLayer_1::returnInBox(vector& PuzzleBox) int i=0; for(int col=1;colm_test1.m_connections=m_constraintMatrix[col][row].m_connections; + PuzzleBox[i++].m_test1.m_connections=m_constraintMatrix[col][row].m_connections; } diff --git a/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1_Properties.h b/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1_Properties.h index 5915ff7..cca5f0e 100644 --- a/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1_Properties.h +++ b/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1_Properties.h @@ -17,4 +17,7 @@ private: }; + + + #endif //SOURCE_ABSTRACTIONLAYER_1_PROPERTIES_H diff --git a/Source/functions/solve/puzzleExtension.cpp b/Source/functions/solve/puzzleExtension.cpp index d266b6e..b09fe08 100644 --- a/Source/functions/solve/puzzleExtension.cpp +++ b/Source/functions/solve/puzzleExtension.cpp @@ -5,25 +5,45 @@ #include "../../header/solve.h" -void Puzzle::printPuzzle() {} -void Puzzle::putIntoBox() {}//puts a puzzlepiece back into its box +void Puzzle::printPuzzle() +{ + //print every layer individually for now and later make complete visual +} + +//puts a puzzlepiece back into its box +void Puzzle::putIntoBox() +{ + Part tmpPart; + for(int i=0;igetSizeAsCoor().col;i++) + { + for(int j=0;jgetSizeAsCoor().row;j++) + { + //TODO! add rotation of all parts + //TODO! add id to every part (how) + tmpPart.m_test1=this->a1->m_constraintMatrix[i][j]; + //TODO! add all other layers here + myBox.emplace_back(tmpPart); + } + } +} //shuffles the existing box in Puzzle void Puzzle::shuffle() { random_shuffle(myBox.begin(),myBox.end()); - for (auto &i:myBox) - { - //i.myLayers->m_test1 - //shift(rand()%4,i); - //i.resetShift(); - } } - -void Puzzle::removeConstrains(coor removeCoordinates) {}//deletes all constraints from all abstractionlayers +//deletes all constraints from all abstractionlayers +void Puzzle::removeConstrains(coor removeCoordinates) +{ + this->a1->RemoveConstraintOnPosition(removeCoordinates); +} void Puzzle::createRandomPuzzle() { a1->CreateRandomPuzzle(); -} \ No newline at end of file +} + +void Puzzle::createp_box() +{ +} diff --git a/Source/header/input.h b/Source/header/input.h index a563c6f..f40098a 100755 --- a/Source/header/input.h +++ b/Source/header/input.h @@ -38,7 +38,8 @@ public: m_numOfRotations = numOfRotations; } - LayerContainer* myLayers; + AbstractionLayer_1_Properties m_test1; + DestructionPower_Properties m_destruction; private: int32_t m_partID; uint8_t m_numOfRotations; diff --git a/Source/header/solve.h b/Source/header/solve.h index 430d945..76ba6ba 100755 --- a/Source/header/solve.h +++ b/Source/header/solve.h @@ -50,10 +50,11 @@ public: void removeConstrains(coor removeCoordinates); void printPuzzle(); - void createRandomBox(){createRandomPuzzle();putIntoBox();shuffle();} + void createRandomBox(){createRandomPuzzle();putIntoBox();shuffle();createp_box();} void createRandomPuzzle(); void putIntoBox(); void shuffle(); + void createp_box(); vector myBox; vector p_myBox; @@ -64,14 +65,6 @@ private: unsigned int cols; }; -class LayerContainer -{ -public: - AbstractionLayer_1_Properties m_test1; - DestructionPower_Properties m_destruction; -}; - - bool next(vector& log, vector& p_Box, Puzzle& puzzleMat); coor calculateNextCoor(vector& log, vector& p_Box, Puzzle& puzzleMat); void solve(vector& log, vector& p_Box, Puzzle& puzzleMat); diff --git a/Source/main.cpp b/Source/main.cpp index c71d606..3db123b 100644 --- a/Source/main.cpp +++ b/Source/main.cpp @@ -13,7 +13,6 @@ int main() //some advanced solver stuff vector log; - vector p_myFirstBox; Puzzle puzzleMat(cols, rows); puzzleMat.createRandomBox();