From instruction: Draw a straight line and follow it
Code: algorithmic paint-clutter by Gasten
In Python/PyGame. Draw a line, follow with another line, follow with another line, follow with another line, follow....
import pygame, random, time pygame.init() screen = pygame.display.set_mode((320,240)) surf = pygame.Surface(screen.get_size()) surf = surf.convert() surf.fill((250,250,250)) screen.blit(surf, (0,0)) pygame.display.flip() coord = [[]] coord[0] = [random.randrange(0,320),random.randrange(0,240)] while 1: coord.append([random.randrange(0,320),random.randrange(0,240)]) pygame.draw.lines(surf, (0,0,0), False, coord, 2) screen.blit(surf, (0,0)) pygame.display.flip() time.sleep(0.5)
[download]
Written in Python. Released under the GPLv3 license