Skip to content

Instantly share code, notes, and snippets.

@jensens
Created October 18, 2013 08:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jensens/7038583 to your computer and use it in GitHub Desktop.
Save jensens/7038583 to your computer and use it in GitHub Desktop.
All Colours Are Beautyful - Code to show Plone Logo at ACAB Wall https://2013.de.pycon.org/ - see video at http://www.youtube.com/watch?v=__w5u0QsV14 - more info and instructions at http://wiki.python-forum.de/PyConDe/2013/acab
from acabsl import send
from acabsl import update
import acabsl
import colorsys
import random
import time
PLONE_RGB = (0, 131, 190)
PLONE_MATRIX = [
[0, 0, 0, 0, 1, 0, 0, 0, 0],
[0, 0, 1, 1, 0, 1, 1, 0, 0],
[0, 1, 0, 0, 0, 0, 0, 1, 0],
[0, 1, 0, 1, 0, 0, 0, 1, 0],
[1, 0, 0, 0, 0, 1, 0, 0, 1],
[0, 1, 0, 1, 0, 0, 0, 1, 0],
[0, 1, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 1, 1, 0, 1, 1, 0, 0],
[0, 0, 0, 0, 1, 0, 0, 0, 0],
]
def black(x, y):
send(x, y, 0, 0, 0, 0)
def white(x, y):
send(x, y, 255, 255, 255, 0.2)
def blue(x, y):
send(x, y, 0, 131, 190, 0.2)
# (4,0), (5,0), (6,0), (7,0), (8,0)
# (0,1), (1,1), (2,1), (3,1), (4,1), (5,1), (6,1), (7,1), (8,1), (9,1), (10,1), (11,1), (12,1),
# (0,2), (1,2), (2,2), (3,2), (4,2), (5,2), (6,2), (7,2), (8,2), (9,2), (10,2), (11,2), (12,2),
# (0,3), (1,3), (2,3), (3,3), (4,3), (5,3), (6,3), (7,3), (8,3), (9,3), (10,3), (11,3), (12,3),
# (0,4), (1,4), (2,4), (3,4), (4,4), (5,4), (6,4), (7,4), (8,4), (9,4), (10,4), (11,4), (12,4),
# (0,5), (1,5), (2,5), (3,5), (4,5), (5,5), (6,5), (7,5), (8,5), (9,5), (10,5), (11,5), (12,5),
tick = 0.4
pos = [-5, 0]
direction = 1
while True:
for y in range(6):
for x in range(13):
if y == 0 and (x < 4 or x > 8):
print "skip %2d, %2d" % (x, y),
black(x, y)
continue
rel_x = x - pos[0]
rel_y = y - pos[1]
if rel_x < 0 or rel_y < 0 or rel_x >= 9 or rel_y >= 9:
print "white %2d, %2d" % (x, y),
white(x, y)
continue
if PLONE_MATRIX[rel_y][rel_x]:
print "PLONE %2d, %2d" % (x, y),
blue(x, y)
else:
print "WHITE %2d, %2d" % (x, y),
white(x, y)
print
update()
time.sleep(tick)
pos[0] = pos[0] + direction
if pos[0] > 7 or pos[0] < -5:
direction = direction * -1
if pos[0] in range(3, 8):
pos[1] -= direction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment