Sam McElligott - https://github.com/sammce
This Python (3) program shows the blazingly slow performance of bogosort.
Clone the repo:
git clone https://github.com/sammce/bogo.gitcd into the repo directory:
cd bogoSetup a Python virtual environment (optional, but recommended):
python3 -m venv venvActivate the virtual environment (only if you did the last step):
source venv/bin/activateInstall dependencies listed in requirements.txt:
The only package this program relies on is samutil, written by yours truly.
python3 -m pip install -r requirements.txtYou can now run the program via:
python3 bogo.pyThe following table shows the configurable constants at the top of bogo.py and what they're for:
| Name | Purpose | Default | Type |
|---|---|---|---|
LIST_LENGTH |
The length of the list being sorted by bogo | 4 |
int |
ITERATIONS |
How many passes the program should do | 20 |
int |
BAR_CHART_DELAY |
The delay, in seconds, between each chart render | 0.1 |
float |
BAR_CHART_CHAR |
The string to use when representing the lists items | "bogo" |
str |