Skip to content

Instantly share code, notes, and snippets.

@greg76
Created November 4, 2022 12:46
Show Gist options
  • Save greg76/4fd71941124ee03d3a90fa5313c70d6d to your computer and use it in GitHub Desktop.
Save greg76/4fd71941124ee03d3a90fa5313c70d6d to your computer and use it in GitHub Desktop.
emojie animals racing in the terminal
import os
import time
import random
animals = "๐Ÿ…๐Ÿ†๐Ÿฆ“๐Ÿฆฃ๐Ÿ˜๐Ÿฆ›๐Ÿฆ๐Ÿช๐Ÿฆ’๐Ÿฆ˜๐Ÿฆฌ๐Ÿƒ๐Ÿ‚๐Ÿ„๐ŸŽ๐Ÿ–๐Ÿ๐Ÿฆ™๐Ÿ๐ŸฆŒ๐Ÿ•๐Ÿˆ๐Ÿ“๐Ÿ‡๐Ÿฆ"
#animals = "๐Ÿถ๐Ÿฑ๐Ÿญ๐Ÿฐ๐ŸฆŠ๐Ÿป๐Ÿผ๐Ÿฆ๐Ÿฏ๐Ÿจ๐Ÿป๐Ÿฎ"
width = os.get_terminal_size().columns - 2
pos = [width] * len(animals)
def main():
while min(pos) > 0:
os.system('clear')
for i, a in enumerate(animals):
pos[i] -= random.choice([0,1])
print(" " * pos[i], a)
time.sleep(.05)
winner = "".join([animals[i] for i, x in enumerate(pos) if x == min(pos)])
print("The Winner is:", winner, "๐Ÿ†๐ŸŽ‰")
if __name__ == '__main__':
main()%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment