# Code von Brooks Ferebee ########################################################################## rm(list=ls()) ########################################################################## #Graphikparameter werden gesetzt windows(width=11, height=7) par(cex.main=1.3,cex.axis=1.2,cex.lab=1.2,pch=18) par(font.main=1,mar=c(1,1,1,1),pty="s") ########################################################################## farbe<-heat.colors(36) zentrum<-function() { polygon(c(x1,x2,x2,x1),c(y1,y1,y2,y2),col="white") p<<-p*(1-(n-1)/r) xt<-(x1+x2)/2 yt1<-(y1+3*y2)/4 yt2<-(y1+y2)/2 yt3<-(3*y1+y2)/4 text(xt,yt1,paste("n =",n),cex=1) text(xt,yt2,paste((r-(n-1)),"/",r,"=",round((r-n+1)/r,3)),cex=1) text(xt,yt3,paste("w =",round(p,3)),cex=1) readline(n) } links<-function() { n<<-n+1 t<-n/r x1neu<-x1*(1-t)+x2*t polygon(c(x1,x1neu,x1neu,x1),c(y1,y1,y2,y2),col=farbe[n]) x1<<-x1neu zentrum() } oben<-function() { n<<-n+1 t<-n/r y2neu<-y2*(1-t)+y1*t polygon(c(x1,x2,x2,x1),c(y2neu,y2neu,y2,y2),col=farbe[n]) y2<<-y2neu zentrum() } rechts<-function() { n<<-n+1 t<-n/r x2neu<-x2*(1-t)+x1*t polygon(c(x2,x2neu,x2neu,x2),c(y1,y1,y2,y2),col=farbe[n]) x2<<-x2neu zentrum() } unten<-function() { n<<-n+1 t<-n/r y1neu<-y1*(1-t)+y2*t polygon(c(x1,x2,x2,x1),c(y1,y1,y1neu,y1neu),col=farbe[n]) y1<<-y1neu zentrum() } ########################################################################## # Hauptprogramm r<-365 n<-1 p<-1 # Ws(keine Kollision) a<--0.2 b<-1.2 plot(c(a,b),c(a,b),t="n",axes=F,xlab="",ylab="") x1<-0; y1<-0; x2<-1; y2<-1 polygon(c(x1,x2,x2,x1),c(y1,y1,y2,y2)) yt1<-(y1+3*y2)/4 yt2<-(y1+y2)/2 yt3<-(3*y1+y2)/4 xt<-(x1+x2)/2 text(xt,yt1,paste("n =",n),cex=1) text(xt,yt3,paste("w =",round(p,3)),cex=1) readline(0) for (i in 1:9) { links() oben() rechts() unten() } ########################################################################## #Ende readline("Ende") graphics.off()