Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace Gameplay
class StickCollectionModel;
struct Stick;
enum class SortType;
enum class SortingState;

class StickCollectionController
{
Expand All @@ -20,6 +21,7 @@ namespace Gameplay

std::vector<Stick*> sticks;
SortType sort_type;
SortingState sort_State;

std::thread sort_thread;

Expand All @@ -46,6 +48,8 @@ namespace Gameplay
bool isCollectionSorted();
void destroy();

int color_delay;

public:
StickCollectionController();
~StickCollectionController();
Expand All @@ -64,6 +68,20 @@ namespace Gameplay
int getNumberOfSticks();
int getDelayMilliseconds();
sf::String getTimeComplexity();
void processBubbleSort();
void processInsertionSort();
void processSelectionSort();
void processMergeSort();
void InPlaceMerge(int left, int mid, int right);
void MergeSort(int left, int right);
void processQuickSort();
int partition(int low, int high);
void quickSort(int low, int high);
void ProcessRadixSort();
void completedColour();
void countSort(int exponent);
void RadixSort();
void updateStickPosition(int i);
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ namespace Gameplay
QUICK_SORT,
RADIX_SORT,
};

enum class SortingState {
Sorting,
NotSorting,
};
class StickCollectionModel
{
public:
Expand All @@ -29,7 +32,8 @@ namespace Gameplay
const sf::Color placement_position_element_color = sf::Color::Green;
const sf::Color selected_element_color = sf::Color::Blue;

const long operation_delay = 150;
const long operation_delay = 10;
const int colorDelay = 10;

StickCollectionModel();
~StickCollectionModel();
Expand Down
Loading