X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=src%2Fgenesorter.cpp;h=8126d6aaa5781336ab03ba3a822f4d72f4c8820d;hb=e81855989d0f0e124e0ec770b417bcb099959391;hp=8643702250f82ac6b90bbfd08f6b65aaf0e85ee2;hpb=8827131c37c21740b5ac8acf6da9ff598de3f166;p=germs.git diff --git a/src/genesorter.cpp b/src/genesorter.cpp index 8643702..8126d6a 100644 --- a/src/genesorter.cpp +++ b/src/genesorter.cpp @@ -32,13 +32,13 @@ using namespace std; GeneSorter::ActionList GeneSorter::sort(const GeneOrder& go){ ActionList al; GeneOrder temp(go); - while(countCycles(temp) != temp.size() - 1){ + while(inversionDistance(go) > 0){ ActionList safe = safeActions(go); if (safe.size() > 0){ safe[0](temp); al.push_back(safe[0]); }else - return ActionList(); //TODO: Need to handle other cases here. + return ActionList(); //TODO: Need to handle hurdles. } return al; }