Skip to content

Instantly share code, notes, and snippets.

@villares
Created August 27, 2021 00:59
Show Gist options
  • Save villares/2812d8704acd9112f1a0c97b0ad46767 to your computer and use it in GitHub Desktop.
Save villares/2812d8704acd9112f1a0c97b0ad46767 to your computer and use it in GitHub Desktop.
# estruturas de dados listas, tuplas
# loop for
# enumerate()
# grades, grade de elementos numerados
from random import shuffle
pos_celulas = []
tam = 40 # tamanho
def setup():
size(400, 400)
textSize(20)
textAlign(CENTER, CENTER)
for y in range(0, 400, tam):
for x in range(0, 400, tam):
pos_celulas.append((x, y))
shuffle(pos_celulas)
# print(pos_celulas)
def draw():
background(0)
for i, (x, y) in enumerate(pos_celulas):
fill(255)
ellipse(x + tam / 2, y + tam / 2, tam, tam)
fill(0)
text(i, x + tam / 2, y + tam / 2)
# fill(255, 0, 0)
# circle(x, y, 5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment