Created
August 18, 2017 10:34
-
-
Save darxtrix/7e30fc807b738c73c2fdec8e0e78421c to your computer and use it in GitHub Desktop.
Visualizations for lehar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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