program weed implicit none real x,y,newx,newy,rand_num,ran2,sqr3_6 integer maxit,ii,iseed,i_switch,pgopen,i_symbol external ran2 if (pgopen('/xwin').le.0) stop call pgpap(6.0,1.0) call pgenv(-0.55,0.55,-0.05,1.05,1,-1) call pgsci(1) call pgscr(16,0.6,0.6,0.2) i_symbol = -1 100 write(*,*) 'What is the total number of iteration ?' read (*,*) maxit write(*,*) 'Give a random seed integer :' read (*,*) iseed call pgsci(16) x = 0.0 y = 1.0 sqr3_6 = sqrt(3.0)/6 DO 1000, II=1,MAXIT c call pgbbuf c do i=1,20 rand_num = ran2(iseed) if (rand_num.gt.0.5) then newx = -0.5*x + sqr3_6*y newy = sqr3_6*x + 0.5*y else newx = -2*x/3 newy = (2*y + 1.0)/3 endif x = newx y = newy c enddo call pgpt(1,x,y,i_symbol) c call pgebuf 1000 CONTINUE 104 write(*,*) 'More points to draw ? (1=YES;0=NO)' read (*,*) i_switch if (i_switch.eq.0) goto 102 if (i_switch.eq.1) goto 100 goto 104 102 continue call pgclos end