changed minor stuff
This commit is contained in:
parent
e947a8b24f
commit
1e0018c6a4
@ -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;
|
||||
|
@ -25,6 +25,7 @@ bool next(vector<LogEntry>& log, vector<PuzzlePiece*>& 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<LogEntry>& log, vector<PuzzlePiece*>& 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<LogEntry>& log, vector<PuzzlePiece*>& p_Box, Puzzle& puzzleMat
|
||||
case 1:
|
||||
abstractionlayer1solver(log,p_Box,puzzleMat);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user