@mvaganov/

spirograph

Python (with Turtle)

No description

fork
loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.7495391297257255","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IHR1cnRsZQp0ID0gdHVydGxlLlR1cnRsZSgpCnQuc3BlZWQoMCkKZGVmIHJhbmRvbUFkanVzdChtLCBhKToKICB0LmZvcndhcmQobSkKICB0LnJpZ2h0KGEpCmRlZiBjb2xvckNsYW1wKGMpOgogICAgYyAlPSA1MTIKICAgIHJldHVybiAoYywgMjU1LShjLTI1NikpW2MgPj0gMjU2XQppbXBvcnQgcmFuZG9tCndoaWxlIFRydWU6CiAgY291bnQgPSByYW5kb20ucmFuZGludCgxLDgpCiAgcmFkID0gW10KICBhbmcgPSBbXQogIGZvciBpIGluIHJhbmdlKDAsY291bnQpOgogICAgcmFkLmFwcGVuZChyYW5kb20ucmFuZG9tKCkpCiAgICBhbmcuYXBwZW5kKHJhbmRvbS5yYW5kb20oKSozNjApCiAgICBwcmludChzdHIoaSkrIiAiK3N0cihyYWRbaV0pKyIsIitzdHIoYW5nW2ldKSkKICB0LnBlbnVwKCkKICB0LmdvdG8oMCwwKQogIHQucGVuZG93bigpCiAgY3IgPSAocmFuZG9tLnJhbmRvbSgpIC0gcmFuZG9tLnJhbmRvbSgpKSoxMAogIGNnID0gKHJhbmRvbS5yYW5kb20oKSAtIHJhbmRvbS5yYW5kb20oKSkqMTAKICBjYiA9IChyYW5kb20ucmFuZG9tKCkgLSByYW5kb20ucmFuZG9tKCkpKjEwCiAgZm9yIGNvdW50ZXIgaW4gcmFuZ2UoMCwgMTAwMCk6CiAgICB0LndpZHRoKGNvdW50ZXIvMTAwKQogICAgYyA9IGNvdW50ZXIrMTAwMAogICAgciA9IGNvbG9yQ2xhbXAoYypjcikKICAgIGcgPSBjb2xvckNsYW1wKGMqY2cpCiAgICBiID0gY29sb3JDbGFtcChjKmNiKQogICAgdC5jb2xvcihyLGcsYikKICAgIGZvciBpIGluIHJhbmdlKDAsY291bnQpOgogICAgICByYW5kb21BZGp1c3QoY291bnRlcipyYWRbaV0sIGFuZ1tpXSkKICAgIHAgPSB0LnBvcygpCiAgICBpZiBwWzBdIDwgLTMwMCBvciBwWzBdID4gMzAwIG9yIHBbMV0gPCAtMzAwIG9yIHBbMV0gPiAzMDA6CiAgICAgIGJyZWFr"},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import turtle
t = turtle.Turtle()
t.speed(0)
def randomAdjust(m, a):
  t.forward(m)
  t.right(a)
def colorClamp(c):
    c %= 512
    return (c, 255-(c-256))[c >= 256]
import random
while True:
  count = random.randint(1,8)
  rad = []
  ang = []
  for i in range(0,count):
    rad.append(random.random())
    ang.append(random.random()*360)
    print(str(i)+" "+str(rad[i])+","+str(ang[i]))
  t.penup()
  t.goto(0,0)
  t.pendown()
  cr = (random.random() - random.random())*10
  cg = (random.random() - random.random())*10
  cb = (random.random() - random.random())*10
  for counter in range(0, 1000):
    t.width(counter/100)
    c = counter+1000
    r = colorClamp(c*cr)
    g = colorClamp(c*cg)
    b = colorClamp(c*cb)
    t.color(r,g,b)
    for i in range(0,count):
      randomAdjust(counter*rad[i], ang[i])
    p = t.pos()
    if p[0] < -300 or p[0] > 300 or p[1] < -300 or p[1] > 300:
      break
result
console