diff options
author | Mattias Andrée <maandree@kth.se> | 2023-12-23 21:49:23 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2023-12-23 21:54:20 +0100 |
commit | 99cfcb40d2cdf38e63438020e52f5f72c70c72fc (patch) | |
tree | a8057f08a6ffbee0850dc9b5628aa4794db1e799 | |
download | doughnut.py-99cfcb40d2cdf38e63438020e52f5f72c70c72fc.tar.gz doughnut.py-99cfcb40d2cdf38e63438020e52f5f72c70c72fc.tar.bz2 doughnut.py-99cfcb40d2cdf38e63438020e52f5f72c70c72fc.tar.xz |
First commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r-- | LICENSE | 23 | ||||
-rw-r--r-- | README | 3 | ||||
-rw-r--r-- | doughnut.py | 28 |
3 files changed, 54 insertions, 0 deletions
@@ -0,0 +1,23 @@ +MIT License + +Copyright (c) 2021 Julius Šyvis (single-line implemention, this work is derived from) + +Copyright (c) 2023 Mattias Andrée + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. @@ -0,0 +1,3 @@ +Doughnut shaped Python code that renders an animated doughnut. + +Based on https://github.com/Julius-Syvis/DonutPy diff --git a/doughnut.py b/doughnut.py new file mode 100644 index 0000000..577aa57 --- /dev/null +++ b/doughnut.py @@ -0,0 +1,28 @@ +ᅠ =lambda:([(pr) + () for b in[[ (fun() ,b) + for(z)in[[((0))for(XX)in range + (1760)]] for (b) in[[("\n") if (k % + 80) == 79 else(" ") for k 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 (A), sin (A) )] 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(################# +#################### #### License: MIT ### +## Copyright 2023 # #################### +## Mattias Andrée # # Based on work by # +#################### # Julius Šyvis 2021 # + 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 + fun 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))]] and A + + 0.02);A,sin,cos=0,__import__('math').sin,\ + __import__('math').cos;print("\x1b[2" + "J");any(0 for _ in __import__( + 'iter'+'tools').repeat(0) + if (A :=ᅠ())) |