diff --git a/.DS_Store b/.DS_Store
index 3d5d276..142472a 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/Legacy/.DS_Store b/Legacy/.DS_Store
new file mode 100644
index 0000000..1fc12ec
Binary files /dev/null and b/Legacy/.DS_Store differ
diff --git a/Source/.DS_Store b/Source/.DS_Store
index b92885f..6ad420f 100644
Binary files a/Source/.DS_Store and b/Source/.DS_Store differ
diff --git a/Source/.idea/workspace.xml b/Source/.idea/workspace.xml
index 269cd01..58b236b 100644
--- a/Source/.idea/workspace.xml
+++ b/Source/.idea/workspace.xml
@@ -22,21 +22,64 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -56,8 +99,9 @@
@@ -68,8 +112,10 @@
true
DEFINITION_ORDER
+
-
+
+
@@ -183,26 +229,31 @@
+
+
+
+
+
-
+
-
+
-
+
-
-
-
-
+
+
+
+
-
+
@@ -210,7 +261,7 @@
-
+
@@ -221,7 +272,16 @@
-
+
+
+
+ file://$PROJECT_DIR$/main.cpp
+ 44
+
+
+
+
+
@@ -509,6 +569,14 @@
+
+
+
+
+
+
+
+
@@ -523,54 +591,68 @@
-
+
-
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
diff --git a/Source/cmake-build-debug/Source b/Source/cmake-build-debug/Source
index 8854065..7321fd9 100755
Binary files a/Source/cmake-build-debug/Source and b/Source/cmake-build-debug/Source differ
diff --git a/Source/functions/.DS_Store b/Source/functions/.DS_Store
index c8496ab..5b9b83e 100644
Binary files a/Source/functions/.DS_Store and b/Source/functions/.DS_Store differ
diff --git a/Source/functions/solve/structure.cpp b/Source/functions/solve/structure.cpp
index e0f0f17..fb94944 100755
--- a/Source/functions/solve/structure.cpp
+++ b/Source/functions/solve/structure.cpp
@@ -4,15 +4,17 @@ void status(vector& log, vector& p_Box, Puzzle& puzzleMa
bool next(vector& log, vector& p_Box, Puzzle& puzzleMat)
{
//log not yet started
+ /*
if(!(log.size()))
- {
+ {
log.push_back(LogEntry());
- log.back().myCoor = calculateFirstCoor(log, p_Box, puzzleMat);
- solve(log, p_Box,puzzleMat);
+ log.back().myCoor = calculateNextCoor(log, p_Box, puzzleMat);
+ solve(log, p_Box,puzzleMat);
}
+ */
//last log element is set, create new log element
- else if(log.back().isSet())
+ if(!(log.size()) || log.back().isSet())
{
if(!(p_Box.size()))
{
@@ -20,8 +22,8 @@ bool next(vector& log, vector& p_Box, Puzzle& puzzleMat)
return 0;
}
log.push_back(LogEntry());
- log.back().myCoor = calculateNextCoor(log, p_Box, puzzleMat);
- solve(log, p_Box,puzzleMat);
+ log.back().myCoor = calculateNextCoor(log, p_Box, puzzleMat);
+ solve(log, p_Box,puzzleMat);
}
//last log element is empty, backtrack
@@ -35,7 +37,7 @@ bool next(vector& log, vector& p_Box, Puzzle& puzzleMat)
if(log.back().abstractionLevel < MAX_ABSTRAX)
{
log.back().advance();
- solve(log,p_Box,puzzleMat);
+ solve(log,p_Box,puzzleMat);
}
//no more layers, pick first
else
@@ -47,13 +49,13 @@ bool next(vector& log, vector& p_Box, Puzzle& puzzleMat)
//case last log exactly one solution
else if(log.back().PieceCollector.size() == 1)
- {
+ {
if(log.back().hasRandomed())
{
if(log.back().abstractionLevel < MAX_ABSTRAX)
{
log.back().advance();
- solve(log,p_Box,puzzleMat);
+ solve(log,p_Box,puzzleMat);
}
else
setsolution(log,p_Box,puzzleMat);
@@ -64,20 +66,28 @@ bool next(vector& log, vector& p_Box, Puzzle& puzzleMat)
return 1;
}
-
+/*
coor calculateFirstCoor(vector& log, vector& p_Box, Puzzle& puzzleMat)
{
//returns coor of first piece
coor firstCoor(0,0);
return firstCoor;
}
+*/
coor calculateNextCoor(vector& log, vector& p_Box, Puzzle& puzzleMat)
{
//level 1:
//go left to right, then increase current row
+
+ if (log.size() == 1)
+ return coor(0,0);
+
+
int m= log.rbegin()[1].myCoor.m;
int n= log.rbegin()[1].myCoor.n;
+
+
if(m& log, vector& p_Box, Puzzle& puz
//remove first element in last logelement from box
for(int i=0;i& log, vector& p_Box, Puzzle& puz
//tell log entry that it is set
log.back().Set();
-}
+}
bool backtrack(vector& log, vector& p_Box, Puzzle& puzzleMat)
{
//following possibilities:
//last log entry empty - delete last log + backtrack
if(!(log.back().PieceCollector.size()))
- {
+ {
puzzleMat.removePiece(log.back().myCoor.m, log.back().myCoor.n);
- log.pop_back();
+ log.pop_back();
backtrack(log,p_Box,puzzleMat);
return 1;
}
@@ -188,14 +198,14 @@ bool backtrack(vector& log, vector& p_Box, Puzzle& puzzl
//shuffleup
random_shuffle(p_Box.begin(),p_Box.end());
puzzleMat.removePiece(log.back().myCoor.m, log.back().myCoor.n);
- log.pop_back();
+ log.pop_back();
//cout << "removed" << endl;
- //status(log,p_Box,puzzleMat);
+ //status(log,p_Box,puzzleMat);
backtrack(log,p_Box,puzzleMat);
return 1;
}
-
+
//last log entry multiple solutions (and current one was randomed) - delete randomed piece and go to next
else if((log.back().PieceCollector.size())>1)
{
@@ -216,11 +226,11 @@ bool backtrack(vector& log, vector& p_Box, Puzzle& puzzl
p_Box.push_back(log.back().PieceCollector[0]);
//shuffleup
random_shuffle(p_Box.begin(),p_Box.end());
- log.back().PieceCollector.erase(log.back().PieceCollector.begin());
-
+ log.back().PieceCollector.erase(log.back().PieceCollector.begin());
+
if(log.back().PieceCollector.size()==1)
log.back().decreaseRandomed();
-
+
//for abstraction layer 1 so that first rotation solution is set.
(*(log.back().PieceCollector[0])).resetShift();
setsolution(log,p_Box,puzzleMat);
@@ -253,7 +263,7 @@ void status(vector& log, vector& p_Box, Puzzle& puzzleMa
{
(*(log[i].PieceCollector[j])).printPiece();
cout << endl;
- }*/
+ }*/
}
cout << endl;
diff --git a/Source/main.cpp b/Source/main.cpp
index ee7e737..f2bf530 100644
--- a/Source/main.cpp
+++ b/Source/main.cpp
@@ -9,7 +9,7 @@
int main()
{
- int cols=10, rows=10;
+ int cols=10, rows=20;
//some basic part stuff
vector myFirstPuzzle;
Part myFirstPart;