diff --git a/2/puzzle2p2.cpp b/2/puzzle2p2.cpp index 390c63c..ba40743 100644 --- a/2/puzzle2p2.cpp +++ b/2/puzzle2p2.cpp @@ -32,6 +32,7 @@ int main(){ } list currentLevelsBackup = currentLevels; + int numOfLevelsInLine = currentLevels.size(); int numOfLevelsProcessed = 0; auto curListIt = currentLevels.begin(); curListIt++; //point to second item in list @@ -67,6 +68,7 @@ int main(){ levelStaysSame.push_front(index); } } + float averageChange = totalChange/(currentLevels.size()-1); //we use average change to smooth out the data if (totalChange>0){ dir= UP; @@ -74,23 +76,12 @@ int main(){ dir = DOWN; } - if (dir==UP&&levelGoDown.size()>1){ //if the overall direction goes up and more then 1 level go down the list is bad + if (dir==UP&&levelGoDown.size()>2){ //if the overall direction goes up and more then 2 leves go down the list is bad currentLevels.clear(); - } else if (dir==DOWN&&levelGoesUp.size()>1){ //same as above but opiosite dirrection + } else if (dir==DOWN&&levelGoesUp.size()>2){ //same as above but opiosite dirrection currentLevels.clear(); } - if (levelStaysSame.size()>1){ //cant have more then 1 number the same or the list is bad - currentLevels.clear(); - } - - if (!currentLevels.empty()&&levelStaysSame.size()==1){ - auto itNumberToDelete = currentLevels.begin(); - advance(itNumberToDelete,levelStaysSame.front()); - currentLevels.erase(itNumberToDelete); - listDirty = true; - } - if (!currentLevels.empty()){ if (dir==UP&&levelGoDown.size()==1){ list::iterator itNumberToDelete = currentLevels.begin(); @@ -103,16 +94,16 @@ int main(){ currentLevels.erase(itNumberToDelete); listDirty=true; } - - int numOfLevelsInLine = currentLevels.size(); //need to pull the first one to have something to compare to int prevlevel = currentLevels.front(); currentLevels.pop_front(); - numOfLevelsProcessed++; for (int level = currentLevels.front(); !currentLevels.empty();level=currentLevels.front()){ if (abs(prevlevel-level)>3) {currentLevels.clear();break;} + if(prevlevel==level){ currentLevels.clear();break;} + if(dir==UP&&(prevlevelcurrentLevels.front())) {currentLevels.clear();break;} prevlevel=currentLevels.front(); currentLevels.pop_front(); diff --git a/2/puzzle2p2.exe b/2/puzzle2p2.exe index aa699ec..f9122b3 100644 Binary files a/2/puzzle2p2.exe and b/2/puzzle2p2.exe differ diff --git a/2/puzzle2p2.ilk b/2/puzzle2p2.ilk index e69cb09..a8b2ba6 100644 Binary files a/2/puzzle2p2.ilk and b/2/puzzle2p2.ilk differ diff --git a/2/puzzle2p2.obj b/2/puzzle2p2.obj index f19b79b..d9aa1ed 100644 Binary files a/2/puzzle2p2.obj and b/2/puzzle2p2.obj differ diff --git a/2/puzzle2p2.pdb b/2/puzzle2p2.pdb index 5b20e4e..72b6e99 100644 Binary files a/2/puzzle2p2.pdb and b/2/puzzle2p2.pdb differ diff --git a/2/vc140.pdb b/2/vc140.pdb index ffe014e..a616eac 100644 Binary files a/2/vc140.pdb and b/2/vc140.pdb differ