# toile2023.py

Created by schraf

Created on October 31, 2023

4.9 KB

```from kandinsky import *
from math import *

fill_rect(0,0,320,222,(0,)*3)

def choix(i):
if i==3:return "DFIBDCIRGBAZHLAMFHAXGAISDOICDJJKDTJJEEIBDEHZEDILGHBPDSBOGIIKEMIEDFIGGTBYDMIXDAHZDRJHGLBTGIIYDCHYECHMAKHLEBHXAEFPBEGEBFGEINEFJLDUHQAWEVCTITDPBTDOJCDYHHBAGDJHDIIODJIEDGICDLJOERIFDDIHDBHSDWJOEQIFDXIEDVJNEOITGAAZFJAYEYCIFSAVGWBDFOCQIQGSIZFXAXFYIWDTBOFPCQHBBCHCCRIRGPBXGOISGPJDGFINESJPDLIQGCAYFKCFFBCQFACGFJAPHVDBHMDPJEDHIDDKJLFUJKEEIMDMIYDUIBDLIUDFIDDMICDHIBDNBXDZHJEABJFWAWHODBHQDTIDDDIBDRBPGABBFLCCFCAS"

PTS=250
nb=10

w = int(PTS * 80 / 271)
h = PTS // 2 - w

def dist(a,b):
return int(sqrt((a[0]-b[0])**2+(a[1]-b[1])**2))

def coord(n):
if n <= h : return (320, 222 - n / h * 222)
if n <= h + w : return (320 - 320 * (n-h) / w, 222)
if n <= 2 * h + w: return (0, 222 * (n-h-w) / h)
return (320 * (n-2*h-w) / w, 0)

def conv(s):return 26*(ord(s[0])-65)+ord(s[1])-65

for k in range(nb):
fils=choix(k)
a=conv(fils[:2])
(x1,y1) = coord(a)
for i in range(len(fils)/2-1):
a=conv(fils[2*i+2:2*i+4])
(x2,y2)=coord(a)
R = dist((x1,y1),(x2,y2))
for n in range(R):
x=int(x1+(x2-x1)*n/R)
y=int(y1+(y2-y1)*n/R)
(r,g,b) = get_pixel(x,y)
set_pixel(x,y,(min(255,r+8),min(255,g+4), 0))
x1,y1=x2,y2```