switched from raw lambda to stepable

couldn't figure out how to handle sortstate, eventually put it into
bsort class. should be split into timeraction and steppable. and there
shouldn't be a random steppedbsort in App
This commit is contained in:
2026-08-05 00:00:26 +02:00
parent 401841f700
commit 6f7bd9d964
6 changed files with 164 additions and 68 deletions
+29
View File
@@ -0,0 +1,29 @@
#include <cstdio>
#include <utility>
#include "sorters.hpp"
using namespace std;
SteppedBsort::SteppedBsort(SortInput &input): data(input) {};
bool SteppedBsort:: step(){
if(is_finished==true) {
printf("finished");
return true;
}
if(data.values[j]>data.values[j+1])
{
swap(data.values[j], data.values[j+1]);
}
j++;
if(j>=data.values.size()-1 -i){
j=0;
i++;
}
if (i==data.values.size()-1){
is_finished=true;
}
return false;
}