From 1f87d00d8b4de6c7a30f4eebab189594c42c9ec3 Mon Sep 17 00:00:00 2001 From: Raphael Maenle <17550607+g-spacewhale@users.noreply.github.com> Date: Sat, 20 Jan 2018 22:41:48 +0100 Subject: [PATCH] removed debug messages --- .../Layer1/AbstractionLayer_1.cpp | 6 +-- Source/functions/solve/puzzleExtension.cpp | 2 +- Source/functions/solve/structure.cpp | 41 ++----------------- Source/main.cpp | 4 +- 4 files changed, 8 insertions(+), 45 deletions(-) diff --git a/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp b/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp index 064e777..1c7b2a2 100644 --- a/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp +++ b/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp @@ -73,9 +73,7 @@ int AbstractionLayer_1::PoempelSum(uint8_t constraint) //it through qualityVector and removes all that do not trigger PlaceOfPartGood bool AbstractionLayer_1::EvaluateQuality (const coor constraintCoordinate, qualityVector& qVector) { - if(constraintCoordinate.row==23 && constraintCoordinate.col==35) - cout << "in" << endl; - //evaluateQuality = evaluateProbabilaty + //evaluateQuality = evaluateProbabilaty for(int i = 0;im_a1.m_connections)) @@ -226,8 +224,6 @@ bool AbstractionLayer_1::PlaceOfPartGood(coor myCoor, uint8_t& myPart) || (((negativePart & 0b00000011) == 0b00000000) && ((myPart & 0b00000011) == 0b00000000)) ) ) { - if(myCoor.row==18 && myCoor.col==35) - cout << "gud: " << std::bitset<8>(myPart) << endl; return true; } return false; diff --git a/Source/functions/solve/puzzleExtension.cpp b/Source/functions/solve/puzzleExtension.cpp index 775f078..d3ffca8 100644 --- a/Source/functions/solve/puzzleExtension.cpp +++ b/Source/functions/solve/puzzleExtension.cpp @@ -169,7 +169,7 @@ Mat Puzzle::resultImage( vector& log){ // waitKey(0); } - cout << it.PieceCollector[0].second->GetPartID() << endl; + //cout << it.PieceCollector[0].second->GetPartID() << endl; int imageNumber = it.PieceCollector[0].second->GetPartID(); //cout<<"imageIndex: "<< imageNumber << endl; diff --git a/Source/functions/solve/structure.cpp b/Source/functions/solve/structure.cpp index 062dd0e..1070f3a 100755 --- a/Source/functions/solve/structure.cpp +++ b/Source/functions/solve/structure.cpp @@ -44,7 +44,6 @@ void createNextLogElement(vector& log, Puzzle& puzzleMat) log.emplace_back(LogEntry(coor(0, 0))); log.back().myCoor = calculateNextCoor(log, puzzleMat); puzzleMat.dp.DestructionOfSurrounding(log.back().myCoor);//calculate dp from surrounding - cout << "-----------------------" << endl; //get all not set pieces for(auto it:puzzleMat.p_myBox) if(!it->set) @@ -110,27 +109,13 @@ void setsolution(vector& log, Puzzle& puzzleMat) //tell log entry that it is set log.back().Set(); puzzleMat.setConstraints(log.back().myCoor,log.back().PieceCollector.begin()->second); - cout << "set:" << log.back().myCoor.col << "," << log.back().myCoor.row << endl; + //cout << "set:" << log.back().myCoor.col << "," << log.back().myCoor.row << endl; //cout << "ID: " << log.back().PieceCollector[0].second->GetPartID() << endl; - int ist=0; - for(auto it:puzzleMat.myBox) - if(!it.set) - ist++; - - int soll = (puzzleMat.getSizeAsCoor().row*puzzleMat.getSizeAsCoor().col*4)-4*((log.back().myCoor.col)*puzzleMat.getSizeAsCoor().row+log.back().myCoor.row+1); - if(soll != ist) - cerr << "soll not ist!!!" << endl; - cout << "ist: " << ist << endl; - cout << "soll: " << soll << endl; - //cout << "log:" << endl; - //for(auto it:log.back().PieceCollector) - // cout << std::bitset<8>(it.second->m_a1.getConnections()) << "|" << it.second->GetPartID() << endl; } bool backtrack(vector& log, Puzzle& puzzleMat) { - cout << "backtracking" ; if(log.empty()) { cout << "Puzzle not solveable!" << endl; @@ -140,17 +125,10 @@ bool backtrack(vector& log, Puzzle& puzzleMat) //if more pieces possible, tset piece as not logged if((log.back().PieceCollector.size())>1) { - //unset puzzlepieces - int count =0; - for(int i=0;iGetPartID()==log.back().PieceCollector.begin()->second->GetPartID())//sets all with partid - { puzzleMat.p_myBox[i]->set=false; - count++; - } - } - cout << "removed " << count << endl; + //remove similar in log Part myPart = *log.back().PieceCollector[0].second;//tmpsaves bad part @@ -159,7 +137,6 @@ bool backtrack(vector& log, Puzzle& puzzleMat) //TODO remove this when further layers are added!!! if(log.back().PieceCollector.size()) // this checks if 'removeSimilar' has cleared entire LogElement { - cout << " next piece" << endl; if(log.back().PieceCollector.size()==1) log.back().decreaseRandomed(); setsolution(log,puzzleMat); @@ -168,20 +145,10 @@ bool backtrack(vector& log, Puzzle& puzzleMat) } //else remove log element and backtrack once more puzzleMat.removeConstrains(log.back().myCoor); //this should remove constraints from all layers - int count =0; - if((log.back().PieceCollector.size())) - { + if((log.back().PieceCollector.size())) //unset all for(int i=0;iGetPartID()==log.back().PieceCollector.begin()->second->GetPartID())//sets all with partid - { puzzleMat.p_myBox[i]->set=false; - count++; - } - } - cout << "removed " << count << endl; - } - cout << " no more pieces" << endl; log.pop_back(); if(!backtrack(log,puzzleMat)) diff --git a/Source/main.cpp b/Source/main.cpp index 56c683c..3520583 100644 --- a/Source/main.cpp +++ b/Source/main.cpp @@ -17,11 +17,11 @@ int main() //puzzleMat.createRandomBox(); - cout << "Solving Puzzle now..."; + cout << "Solving Puzzle now..." << flush; while(next(log, puzzleMat)); cout << "Done!" << endl; - + cout << "Printing Puzzle now..." <