damier.py

Created by laurent-cortot

Created on December 05, 2019

575 Bytes

Création d’un damier


from kandinsky import *

# Valeurs pour espace grahique NumWorks
xMax = 320
yMax = 240 - 20
# - 20 en ordonnée à cause du bandeau info

# Paramétrage du damier
tailleCase = 25
nbCase = 8

# Centrage du damier
xDeb = (xMax - nbCase * tailleCase)//2
yDeb = (yMax - nbCase * tailleCase)//2

# Creation du damier
for iC in range(nbCase):
  for iL in range(nbCase):
    xCase = xDeb+iC*tailleCase
    yCase = yDeb+iL*tailleCase
    couleurCase =color(160*((iC+iL)%2),160*((iC+iL)%2),160*((iC+iL)%2))
    fill_rect(xCase,yCase, tailleCase, tailleCase, couleurCase)

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.