started random algorithm. problem with funciton separation between properties and layer

This commit is contained in:
Raphael Maenle
2017-12-21 12:43:31 +01:00
parent dd9f8f3250
commit bd07d291db
9 changed files with 34 additions and 49 deletions

View File

@ -37,18 +37,4 @@ void createRandomAbstraction2()
i++;
j=0;
}
}
//shuffles around a box, randomizing pieces and orientation
vector<Part> randomBox::shuffle()
{
random_shuffle(Box.begin(),Box.end());
for (auto &i:Box)
{
i.shift(rand()%4);
i.resetShift();
}
numerateBox(Box);
return Box;
}

View File

@ -7,5 +7,23 @@
void Puzzle::printPuzzle() {}
void Puzzle::putIntoBox() {}//puts a puzzlepiece back into its box
void Puzzle::shuffle() {}//shuffles the existing box in Puzzle
//shuffles the existing box in Puzzle
void Puzzle::shuffle()
{
random_shuffle(myBox.begin(),myBox.end());
for (auto &i:myBox)
{
//i.myLayers->m_test1
//shift(rand()%4,i);
//i.resetShift();
}
}
void Puzzle::removeConstrains(coor removeCoordinates) {}//deletes all constraints from all abstractionlayers
void Puzzle::createRandomPuzzle()
{
a1->CreateRandomPuzzle();
}

View File

@ -40,7 +40,7 @@ bool next(vector<LogEntry>& log, vector<Part*>& p_Box,Puzzle& puzzleMat)
void createNextLogElement(vector<LogEntry>& log, vector<Part*>& p_Box, Puzzle& puzzleMat)
{
log.emplace_back(LogEntry());
log.emplace_back(LogEntry(coor(0, 0)));
log.back().myCoor = calculateNextCoor(log, p_Box,puzzleMat);
//getLayerDestructionPowerfromSurrounding();
solve(log, p_Box,puzzleMat);
@ -62,7 +62,6 @@ coor calculateNextCoor(vector<LogEntry>& log, vector<Part*>& p_Box, Puzzle& puzz
if(m<puzzleMat.getSizeAsCoor().col-1) m++;
else if(n<puzzleMat.getSizeAsCoor().row-1){ m=0; n++;}
else return {};
return {m,n};
//return nextCoor;
}