6e71aeebb4
reduced responsibilities of constructors started using more pointers. sessions through app rather than app itself. mostly split view away from app (still hard coded) haven't decoupled sorts from timers as their actuator yet
31 lines
493 B
C++
31 lines
493 B
C++
#include <cstdio>
|
|
#include <memory>
|
|
#include <utility>
|
|
#include "sorters.hpp"
|
|
using namespace std;
|
|
|
|
|
|
SteppedBsort::SteppedBsort(shared_ptr<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;
|
|
}
|