PROGRAM site ! draw site percolation configurations DIM rsite(64,64) LIBRARY "csgraphics" ! define lattice and screen parameters CALL initial(rsite(,),L,p,delta_p,occup$) ! occupy sites for given probability p CALL configuration(rsite(,),L,p,delta_p,occup$) END SUB initial(rsite(,),L,p,delta_p,occup$) RANDOMIZE INPUT prompt "linear dimension of square lattice = ": L INPUT prompt "initial probability p = ": p ! desired increase in p upon mouse click INPUT prompt "delta p = ": delta_p CALL compute_aspect_ratio(L,xwin,ywin) SET WINDOW -0.1*xwin,xwin,-0.1*ywin,ywin ! represent occupied site as blue circle with unit diameter SET COLOR "blue" BOX CIRCLE 2,3,2,3 FLOOD 2.5,2.5 BOX KEEP 2,3,2,3 in occup$ CLEAR SET COLOR "black" LET r = 0.5 BOX LINES 1-r,L+r,1-r,L+r FOR y = 1 to L ! draw lattice sites FOR x = 1 to L ! assign random number to each lattice site LET rsite(x,y) = rnd PLOT POINTS: x,y NEXT x NEXT y END SUB SUB configuration(rsite(,),L,p,delta_p,occup$) DO while p <= 1 SET CURSOR 1,1 PRINT "p =";p FOR y = 1 to L LET yplot = y - 0.5 FOR x = 1 to L IF rsite(x,y) < p then LET xplot = x - 0.5 BOX SHOW occup$ at xplot,yplot END IF NEXT x NEXT y BOX LINES 0.5,L+0.5,0.5,L+0.5 ! redraw lines DO DO GET MOUSE xs,ys,state LOOP until state = 2 ! click on occupied site to see cluster ! click mouse to right of lattice to increase p by delta_p IF (xs < L and xs > 0) and ys <= L then SET COLOR "red" FLOOD xs,ys END IF LOOP until xs > L LET p = p + delta_p SET COLOR "black" LOOP END SUB