diff --git a/s273/s273.pyde b/s273/s273.pyde index 2ec60873..d9108287 100644 --- a/s273/s273.pyde +++ b/s273/s273.pyde @@ -4,21 +4,18 @@ def setup(): global gliphs, tally size(100, 200) noSmooth() # turns off antialiasing - fill(0) - textSize(100) textAlign(CENTER, CENTER) printable_ascii = list(range(32, 127)) + list(range(161, 256)) for c in printable_ascii: gliph = chr(c) background(255) text(gliph, width/2, height/2) - tally = count_pixels() + b, w, o = count_pixels() print("{}({}) black: {} white: {} other: {}" - .format(c, gliph, *tally)) - b, w, o = tally - table.append((c, b, w, o)) + .format(c, gliph, b, w, o)) + table.append((gliph, b, w, o)) table.sort(key=lambda s: s[1]) - gliphs = "".join([chr(c) for c, b, w, o in table]) + gliphs = "".join([gliph for gliph, b, w, o in table]) print(gliphs) def count_pixels(): @@ -36,8 +33,10 @@ def count_pixels(): def draw(): background(255) + fill(0) i = int(map(mouseY, 0, height-1, 0, len(gliphs)-1)) - textSize(100) - text(gliphs[i], width/2, height/2) + gliph, b, w, o = table[i] textSize(8) - text(str(table[i]), width/2, 20) + text("B:{}\nW:{}:\nO:{}".format(b, w, o), width/2, 20) + textSize(100) + text(gliph, width/2, height/2)