Skip to content

Instantly share code, notes, and snippets.

@abap34
Created December 24, 2020 09:02
Show Gist options
  • Save abap34/0dbec249e58df8e2ed03efb24d50520e to your computer and use it in GitHub Desktop.
Save abap34/0dbec249e58df8e2ed03efb24d50520e to your computer and use it in GitHub Desktop.
S = "\t☆
    /\
   /★∴ \
  (人_人_人)
  /∴∵★∵★∵ \
  (_人_人_人_)
  /☆∴∵∴∵★ ∴ \
 (_人★人☆人_ )
    ̄凵 ̄ "
function show_tree()
for s in S
if s in ('∴', '☆', '∵', '★', '☆')
printstyled(s, color=rand(1:255))
elseif s in (' ̄', '凵', ' ̄')
printstyled(s, color=:red)
else
printstyled(s, color=:light_green)
end
end
end
function clean(H)
buf = IOBuffer()
for i in 1:H+1
print(buf, "\x1b[2K") # clear line
print(buf, "\x1b[999D\x1b[$(1)A") # rollback
end
print(buf |> take! |> String)
end
H = 7
buf = IOBuffer()
for i in 1:100
show_tree()
sleep(0.5)
clean(H)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment