From 1e0018c6a4413c321a57de519585c289c393e417 Mon Sep 17 00:00:00 2001 From: g-spacewhale <17550607+g-spacewhale@users.noreply.github.com> Date: Tue, 21 Nov 2017 15:07:15 +0100 Subject: [PATCH] changed minor stuff --- Source/functions/solve/classExtension.cpp | 16 ++++++++-------- Source/functions/solve/structure.cpp | 6 ++++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Source/functions/solve/classExtension.cpp b/Source/functions/solve/classExtension.cpp index 30eb77c..e54388b 100644 --- a/Source/functions/solve/classExtension.cpp +++ b/Source/functions/solve/classExtension.cpp @@ -141,16 +141,16 @@ bool Puzzle::PlaceOfPartGood(unsigned int m,unsigned int n, PuzzlePiece& myPart) //not yet functional!!! bool Puzzle::PlaceOfPart2Good(unsigned int m,unsigned int n, PuzzlePiece& myPart) { - PuzzlePiece tmpPuzzlePiece = myPart; + PuzzlePiece tmpPuzzlePiece = myPart; - //make tmp a negativ part - if((tmpPuzzlePiece.getConnections() & 0b11000000) != 192 || 0) + //make tmp a negative part + if(((tmpPuzzlePiece.getConnections() & 0b11000000) != 0b11000000) || ((tmpPuzzlePiece.getConnections() & 0b11000000) != 0b00000000)) tmpPuzzlePiece.setConnections(tmpPuzzlePiece.getConnections() ^ 0b11000000); - if((tmpPuzzlePiece.getConnections() & 0b00110000) != 48 || 0) + if(((tmpPuzzlePiece.getConnections() & 0b00110000) != 0b00110000) || ((tmpPuzzlePiece.getConnections() & 0b00110000) != 0b00000000)) tmpPuzzlePiece.setConnections(tmpPuzzlePiece.getConnections() ^ 0b00110000); - if((tmpPuzzlePiece.getConnections() & 0b00001100) != 12 || 0) + if(((tmpPuzzlePiece.getConnections() & 0b00001100) != 0b00001100)|| ((tmpPuzzlePiece.getConnections() & 0b00001100) != 0b00000000)) tmpPuzzlePiece.setConnections(tmpPuzzlePiece.getConnections() ^ 0b00001100); - if((tmpPuzzlePiece.getConnections() & 0b00000011) != 3 || 0) + if(((tmpPuzzlePiece.getConnections() & 0b00000011) != 0b00000011) || ((tmpPuzzlePiece.getConnections() & 0b00000011) != 0b00000000)) tmpPuzzlePiece.setConnections(tmpPuzzlePiece.getConnections() ^ 0b00000011); PuzzlePiece negativePart(0); @@ -163,8 +163,8 @@ bool Puzzle::PlaceOfPart2Good(unsigned int m,unsigned int n, PuzzlePiece& myPart negativePart.shift(2); //check tmp part with environment - if(((negativePart.getConnections() & 0b11000000) == (tmpPuzzlePiece.getConnections() & 0b11000000)) && ((negativePart.getConnections() & 0b00110000) == (tmpPuzzlePiece.getConnections() & 0b00110000)) - && ((negativePart.getConnections() & 0b00001100) == (tmpPuzzlePiece.getConnections() & 0b00001100)) && ((negativePart.getConnections() & 0b00000011) == (tmpPuzzlePiece.getConnections() & 0b00000011))) + if(((negativePart.getConnections() & 0b11000000) == (tmpPuzzlePiece.getConnections() & 0b11000000)) && ((negativePart.getConnections() & 0b00110000) == (tmpPuzzlePiece.getConnections ()& 0b00110000)) && + ((negativePart.getConnections() & 0b00001100) == (tmpPuzzlePiece.getConnections() & 0b00001100)) && ((negativePart.getConnections() & 0b00000011) == (tmpPuzzlePiece.getConnections() & 0b00000011))) return 1; return 0; diff --git a/Source/functions/solve/structure.cpp b/Source/functions/solve/structure.cpp index 9833d31..b5ea0ac 100644 --- a/Source/functions/solve/structure.cpp +++ b/Source/functions/solve/structure.cpp @@ -25,6 +25,7 @@ bool next(vector& log, vector& p_Box, Puzzle& puzzleMat) log.back().myCoor = calculateNextCoor(log, p_Box, puzzleMat); solve(log, p_Box,puzzleMat); } + //last log element is empty, backtrack else if(!(log.back().PieceCollector.size())) { @@ -76,11 +77,11 @@ bool next(vector& log, vector& p_Box, Puzzle& puzzleMat) } } //cout << "next" << endl; - if(log.back().myCoor.n>8) + /*if(log.back().myCoor.n>8) { cout << "m: " << log.back().myCoor.m << " n: " << log.back().myCoor.n << endl; status(log,p_Box,puzzleMat); - } + }*/ return 1; } @@ -123,6 +124,7 @@ void solve(vector& log, vector& p_Box, Puzzle& puzzleMat case 1: abstractionlayer1solver(log,p_Box,puzzleMat); break; + default: break; }