added a simple converter from part to puzzlepiece called convertPart2PuzzlePiece. takes and gives vectors only

This commit is contained in:
g-spacewhale 2017-11-30 14:19:25 +01:00
parent 2c71dd7a47
commit 82d0c740c3
3 changed files with 15 additions and 4 deletions

View File

@ -270,3 +270,15 @@ void numerateBox(vector<PuzzlePiece>& myBox)
return;
}
std::vector<PuzzlePiece> convertPart2PuzzlePiece(std::vector<Part> simplePartBox)
{
std::vector<PuzzlePiece> advancedPartBox;
for(int i=0;i<simplePartBox.size();i++)
{
PuzzlePiece tmpNewPiece(0);
tmpNewPiece.setConnections(simplePartBox[i].getConnections());
advancedPartBox.push_back(tmpNewPiece);
}
return advancedPartBox;
}

View File

@ -174,6 +174,7 @@ bool backtrack(vector<LogEntry>& log, vector<PuzzlePiece*>& p_Box, Puzzle& puzzl
{
(log.back().PieceCollector[0])->shift(1);
//check rotion
while((log.back().PieceCollector[0])->getShift() !=0 && (log.back().PieceCollector[0])->getShift() !=3)
{
log.back().PieceCollector[0]->shift(1);

View File

@ -3,13 +3,13 @@
#include "header.h"
#include "../Codicil/test_puzzle_long40x40.h"
//#include "../Codicil/test_puzzle_long40x40.h"
int main()
{
int cols=4, rows=4;
int cols=20, rows=20;
//some basic part stuff
vector<Part> myFirstPuzzle;
Part myFirstPart;
@ -40,8 +40,6 @@ int main()
Puzzle puzzleMat(cols, rows);
//vector<vector<PuzzlePiece*>> ab1class = abstractionLayer1classify(log, p_myFirstBox,puzzleMat);
for(int i=0;i<myFirstBox.size();i++)
cout << (*p_myFirstBox[i]).getShift() << endl;
while(next(log, p_myFirstBox,puzzleMat));
puzzleMat.printPuzzle();