##okhan 4/3/00
##8B
#DIRTY PLACES 
#People in dirty places like to dada their streets 
#The city has decided to have sweepers work around the clock
#to try to tidy it up.  The sweepers move randomly. 
   
import math 

##random generator

def nextRand(val):
 return (val*3 + 234567657) % 12345676
 
def random (seedVal, maxVal):
 return (seedVal % maxVal)

def sweeper1(locx, locy):
 for a in range(0,1):
  g.line(locx+a, locy, locx+a, locy+20)
  
def sweeper2(locx, locy):
 for a in range(0,1):
  g.line(locx, locy+a, locx+10, locy+a)

def sweeper3(locx, locy):
 for a in range(0,2):
  g.line(locx, locy+a, locx+30, locy+a)
  
def dada(x,y):
 g.line(mx, my, mx+4, my+4)
 g.line(mx+5, my+6, mx, my+9)
 g.line(mx+7, my+7, mx+14, my+12)

 
seed1= g.getTime(4)
seed2= g.getTime(3)

while 1:
 for m in range(-10, 140):  
  seed1=  nextRand(seed1)
  seed2=  nextRand(seed2)
  for n in range(-10, 140):
   mz=g.getMouse(3)
   mx=g.getMouse(1)
   my=g.getMouse(2)
   
   ##make some dada mess
   if mz == 100:
    g.pen(40)
    dada(mx,my)
   
   ##street cleaning by 3 different sweepers
   for s in range(0, 10):
    #sweeper1
    g.pen(100)
    sweeper1(n,random(seed1,100))
    for o in range(1,10):
     g.pen(0)
     sweeper1(n-o, random(seed1,100))
     
    #sweeper2
    g.pen(100)
    sweeper2(random(seed1,100),n)
    for o in range(1,10):
     g.pen(random(seed1,10))
     sweeper2(random(seed1,100), n-o)
     
    #sweeper3
    g.pen(100)
    sweeper3(random(seed1,100),130-n)
    for o in range(1,10):
     g.pen(0)
     sweeper3(random(seed1,100), 130-n+1+o)