diff --git a/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp b/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp index b899da8..92183e3 100644 --- a/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp +++ b/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp @@ -6,6 +6,7 @@ #include "../../../header.h" #include +#include void AbstractionLayer_1::PreProcessing(coor mySize, const vector* partArray) { @@ -75,16 +76,20 @@ bool AbstractionLayer_1::CreateRandomPuzzle() tempPiece and_eq (uint8_t)0b11001111; //set piece if piece good + std::cout << "tempPiece = " << std::bitset<8>(tempPiece) << std::endl; if(PlaceOfPartGood(coor(col,row),tempPiece)) { - row++; // Sollte er hier nicht das Puzzleteil irgendwo abspeichern? Weiß aber nicht ob die constraint layer der richtige platz ist, oder nicht eine neue, bzw. die puzzlebox m_constraintMatrix[col][row].m_connections = tempPiece; + printConstraintMatrix(); + row++; } } } } + + //puts all pieces of the current constraint matrix into a puzzlebox qualityVector AbstractionLayer_1::returnInBox(vector& PuzzleBox) { @@ -99,6 +104,13 @@ qualityVector AbstractionLayer_1::returnInBox(vector& PuzzleBox) } +void AbstractionLayer_1::printConstraintMatrix() { + for (auto it1:m_constraintMatrix) { + for (auto it2:it1) + std::cout << "tempPiece = " << std::bitset<8>(it2.m_connections) << std::endl; + std::cout << std::endl; + } +} void AbstractionLayer_1::setEdgeZero() { for(int col = 0; col < m_constraintMatrix.size(); col++) @@ -118,6 +130,7 @@ bool AbstractionLayer_1::PlaceOfPartGood(coor myCoor, uint8_t& myPart) negativePart or_eq (m_constraintMatrix[myCoor.col][myCoor.row-1].m_connections & 0b00001100); negativePart or_eq (m_constraintMatrix[myCoor.col+1][myCoor.row].m_connections & 0b00000011); shift(negativePart,2); + std::cout << "negativePart = " << std::bitset<8>(negativePart) << std::endl; if ( ( ((((negativePart & 0b11000000) ^ (myPart & 0b11000000)) != 0b00000000) && (((myPart & 0b11000000) != 0b00000000) && (negativePart & 0b11000000) != 0b00000000)) || ((((negativePart & 0b11000000) == 0b11000000) || ((myPart & 0b11000000) == 0b11000000)) && (((myPart & 0b11000000) != 0b00000000) && (negativePart & 0b11000000) != 0b00000000)) diff --git a/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.h b/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.h index 7f6762e..adc411f 100644 --- a/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.h +++ b/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.h @@ -27,6 +27,7 @@ public: bool CreateRandomPuzzle(); qualityVector returnInBox(vector& PuzzleBox); + void printConstraintMatrix(); private: }; diff --git a/Source/header/solve.h b/Source/header/solve.h index 3150ed9..345fa09 100755 --- a/Source/header/solve.h +++ b/Source/header/solve.h @@ -43,8 +43,7 @@ public: Puzzle(unsigned int newcols,unsigned int newrows):rows(newrows),cols(newcols) { a1.PreProcessing({rows,cols}, nullptr); - a1.InitialiseConstraintMatrixSize(newcols+2, newrows+2); - a1.setEdgeZero(); + a1.CreateRandomPuzzle(); } coor getSizeAsCoor()