Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 KB | None | 0 0
  1. def setup():
  2.     size(800, 800)
  3.     background(255)
  4.  
  5. def draw():
  6.     b=1
  7.            
  8. def contaparole(x):
  9.     parole=0
  10.     a=x.split(" ")
  11.     for i in a:
  12.         if (i!=""):
  13.             parole=parole+1
  14.     return parole
  15.  
  16. def mousePressed():
  17.     x=1
  18.     y=1
  19.     linee = loadStrings("poesia.txt")
  20.     for linea in linee:
  21.         nump = contaparole(linea)
  22.         if nump % 2== 0:
  23.             stroke(255,117,020)
  24.             a=random(250)
  25.             line(x,y,x+a,y)
  26.             if x<400:
  27.                 x=x+a
  28.             else:
  29.                 x=x-a
  30.                
  31.         elif nump % 3== 0:
  32.             stroke(117,255,020)
  33.             a=random(250)
  34.             line(x,y,x,y+a)
  35.             if y<400:
  36.                 y=y+a
  37.             else:
  38.                 y=y-a
  39.         else:
  40.             stroke(020,117,255)
  41.             a=random(250)
  42.             line(x,y,x+a,y+a)
  43.             if x<400:
  44.                 x=x+a
  45.                 y=y+a
  46.             else:
  47.                 x=x-a
  48.                 y=y-a
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement