H. Chase Stevens Logo

Most Common Tags

  1. programming
  2. python
  3. code
  4. philosophy
  5. evolution
  6. game design
  7. probability
  8. video games
  9. genetic algorithms
  10. government



Sleep sort

posted on: Monday, November 7, 2011 (10:47 pm) by

Here's a little something I whipped up a while ago. It's a python implementation of what is undoubtedly my favorite toy sorting algorithm, Sleep sort. As a bit of warning, IDLE seems to get grumpy when one tries to run this, so it's best to run it directly from the command line.

l = raw_input("List: ").split(' ')
import thread
from time import sleep
def process_number(num):
    global done
    done -= 1
    return 0
done = len(l)
for num in l:
while done != 0:

Tags: algorithms, code, humor, programming, python, sleep sort