panthere.py

Created by schraf

Created on March 16, 2023

2.05 KB


from kandinsky import fill_rect
from time import sleep

def memoire(n):
 if n == 0: return b"!#?#1$$#4#W#9#Q#>#L#C#####+#$#;#I###########%#9#S#7#W#4#'#$#Q#1#(#'#P#0#(#(#Q#,#)#,#O#)#+#-#O#$#-#0#O###+#3#-#######5#+#%###(#5#-#'#4#/###;#*#(#3#K#)#)#(#&#)#K#*#(#&#(#)#L#*#&#'#)#)#L#*#$#'#+#(#N#.#-#(#O#,#/#&#P#+#1#%#P#*#1#&#R#'#2#'#Q#&#3#'$1#######)!$T#+$(#3#5#%#B#5#3#'#@#:#,#)#@#=#####%#-#>#O#:#S#8#T#6#W#4#X#2#(#$#R#0#)#&#I#####%#$#/#)#)#E#6#+#+#C#/#0#/#A#0#-#3#?#1#+#6#,#$#1#P#+###+#W#4#X#3$##*#%#'$$#+#$#'$##1$&#0$'#1$&#0$M"
 if n == 1: return b"!&R#$#H###?#'#B#/#5#+#@#3#+#########.#=#P#;#Q#:#S#7#U#5#V#5#O#<#'###I#:#'#&#H#:#'#'#G#0#######(#(#)#E#0#0#+#D#1#.#.#A#5#)#1#-#%###############%#(#K#-#0#(#J#-#-#####'#L#-#.#)#K#$#$#)#1#######M#$###)$+#*$-#($/#($0#'#K!$+#)$$#1#X#5#T#9#P#=#F#############@#C#I#4#X#1$%#0#S#)#$#/#S#7#U#5#'###Q#4#'#$#R#2#&#%#H#%#*#1#&#%#H#(#(#.#(#%#F#-#%#.#'#&#6#######-#0#%#-#&#&#/#####C#&#.#$#'#/#G#%#4#-$(#+$*#)$,#'$.#'$/#'$/#'$.#$###$$-"
 if n == 2: return b"!)A#$$%###)#)#F#%#####-#6#;#7#######:#5#W#2$%#.$(#+$+#(#+#%#X#%#*#'#T###'#$#)#(#R#)#$#$#&#)#S#.###)#####U#4$'#,#7###########I#(#7#-#-#####%#5#&#3#E#2#$#2#K#####)#%###$#%###&$##&#'###%#%$%#%#)#'$%#%#(#&$0#%%A!$G#1#X#7#=#$#6#;#8#####%#4#X#3$##1#'#$#V#-#'#&#V#,#'#'#W#)#'#(#X#'#'#'$&#%#&#)$&#%#$#+#S#$#(#&###+#3###@#;#/#'#?#:#%#%#)#-#:#;#$#>#######'#-#9#$#H#/#4#%#J#1#0#%#J#2#.#%#N#0$&#*#$#'$(#($/#)$.#*$/#($0#&$5"

COUL = ((0,0,0),(255,255,255))
w,h = 72,28
px = -w

def taille(n):
 return 54 * (n[0] - 35) + n[1] - 34

def remplir(x,y,t,c):
  while t > 0:
    d = min(t, w - x)
    fill_rect(x+px,223-h+y,d,1,c)
    x += d
    t -= d
    if x == w:
      x = 0
      y += 1
      if y >= h: y = 0
  return x,y  
    
def aff():
 global px
 k = 0
 while True:
  k = (k + 1) % 3
  img = memoire(k)  
  i = 0
  x,y = 0,0
  while i < len(img):
   v = img[i] 
   if v == 32 or v == 33:
     c = v - 32
     i += 1
     sleep(.02)
   else:
     t = taille(img[i:i+2])
     x,y = remplir(x,y,t,COUL[c])
     i += 2
     c = 1 - c
  fill_rect(px,223-h,10,h,COUL[1])
  px += 10
  if px > 320: px = -w

aff()