SIDESTICK = False def setup() : global is_taken size(512, 512) background(0) is_taken = [[False] * height for _ in range(width)] is_taken[width/2][height/2] = True def draw() : x = floor(random(width)) y = floor(random(height)) if is_taken[x][y]: return while True: xp = x + floor(random(-1, 2)) yp = y + floor(random(-1, 2)) is_contained = 0 <= xp < width and 0 <= yp < height if is_contained and not is_taken[xp][yp]: x = xp y = yp continue else: if SIDESTICK or (is_contained and is_taken[xp][yp]): is_taken[x][y] = True set(x, y, color(255)) break if frameCount > width * height: noLoop()