Ma playlist de jeux et de tutos pour la NUMWORKS
Vidéo TikTok sur une vraie machine
from cmath import * from kandinsky import * from random import random from time import sleep def orbits(x,y): c = x + y * 1j z = 0j i = 1 ptx, pty = [], [] while i < 200 and abs(z) < 2: ptx.append(z.real) pty.append(z.imag) z = z ** 2 + c i += 1 minx, maxx = min(ptx), max(ptx) miny, maxy = min(pty), max(pty) try: echx = 320 / (maxx - minx) echy = 222 / (maxy - miny) for i in range(len(ptx)): x = int((maxx - ptx[i]) * echx) y = 222 - int((maxy - pty[i]) * echy) set_pixel(x, y, (255,255,0)) except: return u,v = random()-.5, random()-.5 du, dv = 1, 1 while True: fill_rect(0,0,320,222,(0,0,0)) for _ in range(20): orbits(u, v) u += du * random()/100 if abs(u) > .7: du = -du v += dv * random()/100 if abs(v) > .7: dv = -dv sleep(.001)