yiking.py

Created by elodie-gamot

Created on January 31, 2022

642 Bytes


from math import *
from random import *
from kandinsky import *

black = color(0,0,0)
white = color(255,255,255)
width=10
height=10

def hexa():
  
  L=[]
  for i in range(6):
    L.append([1,1,1,randint(0,1),1,1,1])
    L.append([0]*7)
  #Création d'une matrice de 12 lignes avec 7 
  #nombres (0 ou 1) par ligne. 
  
  for i in range(7):
    for j in range(12):
      if L[j][i]==0:
        fill_rect(5+i*height,5+j*width,width,height,white)
      else:
        fill_rect(5+i*height,5+j*width,width,height,black)
  #En parcourant la matrice, si la valeur rencontrée est un 0, le 
  #rectangle est blanc sinon il est noir.