# mirervb.py

Created by andreanx

Created on May 18, 2019

964 Bytes

Mire RVB pour test capacités écran.

Sur NumWorks à ce jour, la ligne d’appel optimale est : mirervb([5,6,5])

```from kandinsky import *

def draw_vline(x,y1,y2,c):
for j in range(y2-y1+1):
set_pixel(x,y1+j,c)

def mirervb11(w=320,h=222):
d=(2**8-1)/(w-1)
for m in range(w):
v=round(d*m)
lv=[(0,0,v),(0,v,0),(0,v,v),(v,0,0),(v,0,v),(v,v,0),(v,v,v)]
for j in range(len(lv)):
draw_vline(m,int(j*h/len(lv)),int((j+1)*h/len(lv)-1),lv[j])

def mirervb(l,w=320,h=222):
if isinstance(color(0,0,0),tuple):
print("incompatible kandinsky.color() behavior")
print("forcing l=[8,8,8] for workaround")
return mirervb11(w,h)
n=len(l)
lb=[]
j=0
for k in range(n):
lb.append(2**j)
j=j+l[k]
l[k]=(2**l[k]-1)/(w-1)
for m in range(w):
lc=[]
for j in range(n):
lc.append(lb[j]*int(l[j]*m))
lv=[]
for j in range(n):
lv.append(lc[j])
for k in range(len(lv)-1):
lv.append(lv[k]+lc[j])
for j in range(len(lv)):
draw_vline(m,int(j*h/len(lv)),int((j+1)*h/len(lv)-1),lv[j])```