/donut-py

Primary LanguagePython

🍩 donut.py

The first-ever donut.c Python clone that looks like a donut!

while ('o_' in dir()) or (A := (0)
               ) or (B := 0) or print((                           
            "\x1b[2J")) or not ((sin := ((                        
         __import__('math'))).sin)) or not (                     
      cos := __import__('math').cos) or (o_ := (                   
     True)): [pr() for b in [[(func(), b) for ((z                 
    )) in [[0 for _ in range(1760)]] for b in [[ (                
   "\n") if ii % 80 == 79 else " " for ii in range(               
  1760)]] for o, D, N in [(o, D, N) for j in range((              
 0), 628, 7) for i in range(0, 628, 2) for (c, d, e,(             
f), g, l, m, n) in [(sin(     i / 100), cos(j / 100),(             
sin(A)), sin(j / 100),          cos(A), cos(i / 100) ,            
cos(B), sin(B))] for              (h) in [d + 2] for (            
D, t) in [ (1 / ( c               * h * e + f * g + (5
)), c * h * g - f *                e)] for (x, y) in [            
(int( 40 + 30 * D * (              l * h * m - t * n)),            
int( 12 + 15 * D * ( l           * h * n + t * (m))))]            
 for (o, N) in [(x + 80 *     y,int(8 * (( f * e -  c              
  * d * g) * m - c * d * e - f * g - l * d * n)))] if             
  0 < x < 80 and 22 > y > 0] if D > z[o] for func in              
   [lambda: (z.pop((o))), lambda: z.insert((o), (D)                
    ),(lambda: (b.pop( o))), lambda: b.insert((o),                 
     ".,-~:;=!*#$@"[ N if N > 0 else 0])]][ 0][1]                 
       ] for pr in [lambda: print("\x1b[H"),                    
         lambda: print("".join(b))] if (A :=
            A + 0.02) and ( B := B + 0.02)]                        
               #..--~~EvanZhouDev:~~--.#                           
                    #...,2023,...#

Run with:

python3 donut.py

Original donut.c idea from Andy Sloane's blog. Original one-line donut.py implementation by Julius Syvis's DonutPy.

If the donut looks vertically stretched, then you may need to adjust your font to be a square font, or just modify line width and font spacing.