Skip to content

Instantly share code, notes, and snippets.

@darxtrix
Created August 18, 2017 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darxtrix/7e30fc807b738c73c2fdec8e0e78421c to your computer and use it in GitHub Desktop.
Save darxtrix/7e30fc807b738c73c2fdec8e0e78421c to your computer and use it in GitHub Desktop.
Visualizations for lehar
import time
import lehar
# Try to hide the cursor
data = [5,4,3,2,1,3,5,1,2]
for i in range(len(data)):
print(" ",end="")
print(lehar.draw(data,color='cyan'),end="")
maxi = data[0]
max_index = 0
for j in range(len(data)-i):
if data[j] > maxi:
maxi = data[j]
max_index = j
data[max_index] = data[j]
data[j] = maxi
time.sleep(1)
print("\r",end="")
print(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment