Dispatcherprobleme bestehen
Springt momentan nicht in die nächste Reihe. Debugging gehört hier weiter gemacht.
This commit is contained in:
parent
c78518b1e9
commit
6754873cfd
@ -15,7 +15,7 @@ bool DestructionPower::PreProcessing(coor mySize,const vector<Part*>* partArray)
|
|||||||
{
|
{
|
||||||
cout << "DestructionPower Preprocessing... ";
|
cout << "DestructionPower Preprocessing... ";
|
||||||
|
|
||||||
InitialiseConstraintMatrixSize(mySize.row,mySize.col);
|
InitialiseConstraintMatrixSize(mySize.col,mySize.row);
|
||||||
cout << "Done!" << endl;
|
cout << "Done!" << endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -74,8 +74,8 @@ void AbstractionLayer_1::CreateRandomPuzzle()
|
|||||||
std::minstd_rand simple_rand;
|
std::minstd_rand simple_rand;
|
||||||
simple_rand.seed((unsigned int)"dumbo");
|
simple_rand.seed((unsigned int)"dumbo");
|
||||||
|
|
||||||
for(int row = 1; row < m_constraintMatrix.size()-1; row++){
|
for(int col = 0; col < m_constraintMatrix.size()-2; col++){
|
||||||
for(int col = 1; col < (m_constraintMatrix[row].size() - 1);)
|
for(int row = 0; row < (m_constraintMatrix[col].size() - 2);)
|
||||||
{
|
{
|
||||||
//create random piece
|
//create random piece
|
||||||
uint8_t tempPiece = 0b00000000;
|
uint8_t tempPiece = 0b00000000;
|
||||||
@ -100,20 +100,20 @@ void AbstractionLayer_1::CreateRandomPuzzle()
|
|||||||
tempPiece|=0b00000010;
|
tempPiece|=0b00000010;
|
||||||
|
|
||||||
//set edges and corners to 00
|
//set edges and corners to 00
|
||||||
if(row == 1)
|
if(row == 0)
|
||||||
tempPiece and_eq (uint8_t)0b00111111;
|
tempPiece and_eq (uint8_t)0b00111111;
|
||||||
if(row == (m_constraintMatrix.size() - 2))
|
if(row == (m_constraintMatrix[col].size() - 3))
|
||||||
tempPiece and_eq (uint8_t)0b11110011;
|
tempPiece and_eq (uint8_t)0b11110011;
|
||||||
if(col == 1)
|
if(col == 0)
|
||||||
tempPiece and_eq (uint8_t)0b11111100;
|
tempPiece and_eq (uint8_t)0b11111100;
|
||||||
if(col == (m_constraintMatrix[row].size() - 2))
|
if(col == (m_constraintMatrix.size() - 3))
|
||||||
tempPiece and_eq (uint8_t)0b11001111;
|
tempPiece and_eq (uint8_t)0b11001111;
|
||||||
|
|
||||||
//set piece if piece good
|
//set piece if piece good
|
||||||
if(PlaceOfPartGood(coor((unsigned int)col,(unsigned int)row),tempPiece))
|
if(PlaceOfPartGood(coor((unsigned int)col,(unsigned int)row),tempPiece))
|
||||||
{
|
{
|
||||||
m_constraintMatrix[col][row].m_connections = tempPiece;
|
m_constraintMatrix[col+1][row+1].m_connections = tempPiece;
|
||||||
col++;
|
row++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,9 +137,10 @@ qualityVector AbstractionLayer_1::returnInBox(vector<Part>& PuzzleBox)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AbstractionLayer_1::printConstraintMatrix() {
|
void AbstractionLayer_1::printConstraintMatrix() {
|
||||||
for (auto it1:m_constraintMatrix) {
|
for (int j=0;j<m_constraintMatrix[0].size();j++) {
|
||||||
for (auto it2:it1)
|
for (int i=0;i<m_constraintMatrix.size();i++)
|
||||||
std::cout << std::bitset<8>(it2.m_connections) << " ";
|
|
||||||
|
std::cout << std::bitset<8>(m_constraintMatrix[i][j].m_connections) << " ";
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
cout.flush();
|
cout.flush();
|
||||||
@ -161,10 +162,10 @@ bool AbstractionLayer_1::PlaceOfPartGood(coor myCoor, uint8_t& myPart)
|
|||||||
|
|
||||||
uint8_t negativePart=0b00000000;
|
uint8_t negativePart=0b00000000;
|
||||||
|
|
||||||
negativePart or_eq (m_constraintMatrix[myCoor.row+1][myCoor.col].m_connections & 0b11000000);
|
negativePart or_eq (m_constraintMatrix[myCoor.col+1][myCoor.row].m_connections & 0b00000011);
|
||||||
negativePart or_eq (m_constraintMatrix[myCoor.row][myCoor.col-1].m_connections & 0b00110000);
|
negativePart or_eq (m_constraintMatrix[myCoor.col][myCoor.row-1].m_connections & 0b00001100);
|
||||||
negativePart or_eq (m_constraintMatrix[myCoor.row-1][myCoor.col].m_connections & 0b00001100);
|
negativePart or_eq (m_constraintMatrix[myCoor.col-1][myCoor.row].m_connections & 0b00110000);
|
||||||
negativePart or_eq (m_constraintMatrix[myCoor.row][myCoor.col+1].m_connections & 0b00000011);
|
negativePart or_eq (m_constraintMatrix[myCoor.col][myCoor.row+1].m_connections & 0b11000000);
|
||||||
shift(negativePart,2);
|
shift(negativePart,2);
|
||||||
if (
|
if (
|
||||||
( ((((negativePart & 0b11000000) ^ (myPart & 0b11000000)) != 0b00000000) && (((myPart & 0b11000000) != 0b00000000) && (negativePart & 0b11000000) != 0b00000000))
|
( ((((negativePart & 0b11000000) ^ (myPart & 0b11000000)) != 0b00000000) && (((myPart & 0b11000000) != 0b00000000) && (negativePart & 0b11000000) != 0b00000000))
|
||||||
|
@ -39,7 +39,7 @@ void Puzzle::putIntoBox()
|
|||||||
for(int rotations=0;rotations<4;rotations++)
|
for(int rotations=0;rotations<4;rotations++)
|
||||||
{
|
{
|
||||||
tmpPart.m_a1.shift(1);
|
tmpPart.m_a1.shift(1);
|
||||||
//TODO! add all other layers and rotationvariance here
|
//TODO! add all other layerswith their rotaionvariance here
|
||||||
myBox.emplace_back(tmpPart);
|
myBox.emplace_back(tmpPart);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -61,6 +61,12 @@ void Puzzle::removeConstrains(coor removeCoordinates)
|
|||||||
}
|
}
|
||||||
void Puzzle::setConstraints(coor setConstraints, Part* constraintPiece)
|
void Puzzle::setConstraints(coor setConstraints, Part* constraintPiece)
|
||||||
{
|
{
|
||||||
|
//dp
|
||||||
|
this->dp.m_constraintMatrix[setConstraints.col][setConstraints.row].DestructionArray.clear();
|
||||||
|
for(auto it:this->tmp_destructionArray)
|
||||||
|
this->dp.m_constraintMatrix[setConstraints.col][setConstraints.row].DestructionArray.emplace_back(it);
|
||||||
|
|
||||||
|
//a1
|
||||||
this->a1.SetConstraintOnPosition(setConstraints,constraintPiece->m_a1);
|
this->a1.SetConstraintOnPosition(setConstraints,constraintPiece->m_a1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,3 +104,14 @@ bool Puzzle::allSet() {
|
|||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Puzzle::clearMat()
|
||||||
|
{
|
||||||
|
for(unsigned int i=0;i<cols;i++)
|
||||||
|
{
|
||||||
|
for(unsigned int j=0;j<rows;j++)
|
||||||
|
{
|
||||||
|
this->removeConstrains({i,j});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -150,7 +150,14 @@ bool backtrack(vector<LogEntry>& log, Puzzle& puzzleMat)
|
|||||||
void calculateTrueDestructionPower(vector<LogEntry>& log, Puzzle& puzzleMat, float Layerworth) {
|
void calculateTrueDestructionPower(vector<LogEntry>& log, Puzzle& puzzleMat, float Layerworth) {
|
||||||
float destructionPower = sqrt(
|
float destructionPower = sqrt(
|
||||||
Layerworth * puzzleMat.dp.m_constraintMatrix[0][0].SpeedTable[log.back().abstractionLevel+1]);
|
Layerworth * puzzleMat.dp.m_constraintMatrix[0][0].SpeedTable[log.back().abstractionLevel+1]);
|
||||||
puzzleMat.dp.setDestructionPower(log.back().myCoor, log.back().abstractionLevel, destructionPower);
|
|
||||||
|
//save destructionArray for when coor is done
|
||||||
|
if(puzzleMat.tmp_destructionArray.empty())
|
||||||
|
for(auto it:puzzleMat.dp.m_constraintMatrix[log.back().myCoor.col][log.back().myCoor.row].DestructionArray)
|
||||||
|
puzzleMat.tmp_destructionArray.emplace_back(it);
|
||||||
|
|
||||||
|
puzzleMat.tmp_destructionArray[log.back().abstractionLevel]=destructionPower;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PART RAUER_WEIDINGER
|
// PART RAUER_WEIDINGER
|
||||||
|
@ -59,12 +59,16 @@ public:
|
|||||||
void printPuzzle();
|
void printPuzzle();
|
||||||
void printBox();
|
void printBox();
|
||||||
|
|
||||||
void createRandomBox(){createRandomPuzzle();putIntoBox();shuffle();createp_box();}
|
void createRandomBox(){
|
||||||
|
myBox.clear();p_myBox.clear();
|
||||||
|
createRandomPuzzle();putIntoBox();
|
||||||
|
printPuzzle();shuffle();createp_box(); clearMat();}
|
||||||
void createRandomPuzzle();
|
void createRandomPuzzle();
|
||||||
void putIntoBox();
|
void putIntoBox();
|
||||||
void shuffle();
|
void shuffle();
|
||||||
void createBox();
|
void createBox();
|
||||||
void createp_box();
|
void createp_box();
|
||||||
|
void clearMat();
|
||||||
|
|
||||||
bool allSet();
|
bool allSet();
|
||||||
|
|
||||||
@ -73,6 +77,8 @@ public:
|
|||||||
|
|
||||||
qualityVector combinedQualityVector;
|
qualityVector combinedQualityVector;
|
||||||
|
|
||||||
|
vector<float> tmp_destructionArray;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
unsigned int cols;
|
unsigned int cols;
|
||||||
|
@ -5,7 +5,7 @@ int LogEntry::randomed(0);
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
||||||
unsigned int cols=36,rows=28;
|
unsigned int cols=6,rows=8;
|
||||||
|
|
||||||
vector<LogEntry> log;
|
vector<LogEntry> log;
|
||||||
Puzzle puzzleMat(cols, rows);
|
Puzzle puzzleMat(cols, rows);
|
||||||
@ -15,7 +15,7 @@ int main()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//puzzleMat.createRandomBox();
|
puzzleMat.createRandomBox();
|
||||||
|
|
||||||
cout << "Solving Puzzle now...";
|
cout << "Solving Puzzle now...";
|
||||||
while(next(log, puzzleMat));
|
while(next(log, puzzleMat));
|
||||||
|
Loading…
Reference in New Issue
Block a user