changed minor stuff

This commit is contained in:
g-spacewhale 2017-11-21 15:07:15 +01:00
parent e947a8b24f
commit 1e0018c6a4
2 changed files with 12 additions and 10 deletions

View File

@ -143,14 +143,14 @@ bool Puzzle::PlaceOfPart2Good(unsigned int m,unsigned int n, PuzzlePiece& myPart
{ {
PuzzlePiece tmpPuzzlePiece = myPart; PuzzlePiece tmpPuzzlePiece = myPart;
//make tmp a negativ part //make tmp a negative part
if((tmpPuzzlePiece.getConnections() & 0b11000000) != 192 || 0) if(((tmpPuzzlePiece.getConnections() & 0b11000000) != 0b11000000) || ((tmpPuzzlePiece.getConnections() & 0b11000000) != 0b00000000))
tmpPuzzlePiece.setConnections(tmpPuzzlePiece.getConnections() ^ 0b11000000); 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); 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); 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); tmpPuzzlePiece.setConnections(tmpPuzzlePiece.getConnections() ^ 0b00000011);
PuzzlePiece negativePart(0); PuzzlePiece negativePart(0);
@ -163,8 +163,8 @@ bool Puzzle::PlaceOfPart2Good(unsigned int m,unsigned int n, PuzzlePiece& myPart
negativePart.shift(2); negativePart.shift(2);
//check tmp part with environment //check tmp part with environment
if(((negativePart.getConnections() & 0b11000000) == (tmpPuzzlePiece.getConnections() & 0b11000000)) && ((negativePart.getConnections() & 0b00110000) == (tmpPuzzlePiece.getConnections() & 0b00110000)) 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))) ((negativePart.getConnections() & 0b00001100) == (tmpPuzzlePiece.getConnections() & 0b00001100)) && ((negativePart.getConnections() & 0b00000011) == (tmpPuzzlePiece.getConnections() & 0b00000011)))
return 1; return 1;
return 0; return 0;

View File

@ -25,6 +25,7 @@ bool next(vector<LogEntry>& log, vector<PuzzlePiece*>& p_Box, Puzzle& puzzleMat)
log.back().myCoor = calculateNextCoor(log, p_Box, puzzleMat); log.back().myCoor = calculateNextCoor(log, p_Box, puzzleMat);
solve(log, p_Box,puzzleMat); solve(log, p_Box,puzzleMat);
} }
//last log element is empty, backtrack //last log element is empty, backtrack
else if(!(log.back().PieceCollector.size())) else if(!(log.back().PieceCollector.size()))
{ {
@ -76,11 +77,11 @@ bool next(vector<LogEntry>& log, vector<PuzzlePiece*>& p_Box, Puzzle& puzzleMat)
} }
} }
//cout << "next" << endl; //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; cout << "m: " << log.back().myCoor.m << " n: " << log.back().myCoor.n << endl;
status(log,p_Box,puzzleMat); status(log,p_Box,puzzleMat);
} }*/
return 1; return 1;
} }
@ -123,6 +124,7 @@ void solve(vector<LogEntry>& log, vector<PuzzlePiece*>& p_Box, Puzzle& puzzleMat
case 1: case 1:
abstractionlayer1solver(log,p_Box,puzzleMat); abstractionlayer1solver(log,p_Box,puzzleMat);
break; break;
default: default:
break; break;
} }