kopia lustrzana https://github.com/villares/sketch-a-day
273 update
rodzic
9078323180
commit
568a163270
|
|
@ -3,10 +3,11 @@ table = []
|
|||
gliphs = ""
|
||||
|
||||
def setup():
|
||||
global gliphs
|
||||
size(100, 100)
|
||||
global gliphs, tally
|
||||
size(100, 200)
|
||||
noSmooth() # turns off antialiasing
|
||||
fill(0)
|
||||
textSize(60)
|
||||
textSize(100)
|
||||
textAlign(CENTER, CENTER)
|
||||
printable_ascii = list(range(32, 127)) + list(range(161, 256))
|
||||
for c in printable_ascii:
|
||||
|
|
@ -18,8 +19,11 @@ def setup():
|
|||
print("{}({}) black: {} white: {} other: {}"
|
||||
.format(c, gliph, *tally))
|
||||
gliphs += gliph
|
||||
table.append(tally)
|
||||
print(gliphs)
|
||||
b, w, o = tally
|
||||
table.append((c, b, w, o))
|
||||
table.sort(key=lambda s: s[1])
|
||||
gliphs = "".join([chr(c) for c, b, w, o in table])
|
||||
print(gliphs)
|
||||
|
||||
def count_pixels():
|
||||
black, white, other = 0, 0, 0
|
||||
|
|
@ -34,4 +38,10 @@ def count_pixels():
|
|||
other += 1
|
||||
return black, white, other
|
||||
|
||||
|
||||
def draw():
|
||||
background(255)
|
||||
i = int(map(mouseY, 0, height-1, 0, len(gliphs)-1))
|
||||
textSize(100)
|
||||
text(gliphs[i], width/2, height/2)
|
||||
textSize(8)
|
||||
text(str(table[i]), width/2, 20)
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue