Skip to content

Instantly share code, notes, and snippets.

@juanluisrto
Last active July 28, 2022 12:04
Show Gist options
  • Save juanluisrto/f19cbb493dc40118c36c123540bccb2e to your computer and use it in GitHub Desktop.
Save juanluisrto/f19cbb493dc40118c36c123540bccb2e to your computer and use it in GitHub Desktop.
Draw a circle with ascii art in one line
deadly_one_liner = (
lambda r, n : print("".join(
["00"
if any((i == p[0] and j == p[1] for p in
(lambda r, n : [
[round((lambda x : 1 - (x**2)/2 + x**4/(4*3*2) - x**6/(6*5*4*3*2))(2*3.1415/n*x)*r + n/2),
round((lambda x : x - (x**3)/6 + x**5/(5*4*3*2) - x**7/(7*6*5*4*3*2))(2*3.1415/n*x)*r + n/2)]
for x in range(-int(n/2),int(n/2))])(r,n)))
or (i == round(n/2) and j < n) or j == round(n/2)
or i == j or i == n - j
else "\n" if j >= n
else "--"
for i in range(1, n)
for j in range(1, n + 1)])))
deadly_one_liner(13,40)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment