via <- function() { dev.new(xpos=650,ypos=10,width=5.2,height=5.7) plot(c(0,15),c(0,15),type="n",xlab="",ylab="",asp=1) mtext("Batti Direzione (E,N,O,S) e Passi (1,...,15). Es: N3",cex=0.8,side=3) abline(h=seq(0,15,1),v=seq(0,15,1),lty=3,col="red") print("Batti x e poi y del punto di partenza"); x <- scan(file="",n=1); y <- scan(file="",n=1); points(x,y,pch=19); print("Batti E3 o S5 o N10 o ...; premi ESC quando hai finito"); while(TRUE) { d <- scan(file="",what="character",n=1); v <- substr(d,1,1); n <- strtoi(substr(d,2,3)); v <- toupper(v); points(x,y,pch=19,col="red"); if(v=="O") {x <- x-n; arrows(x+n,y,x,y,length=0.1)}; if(v=="E") {x <- x+n; arrows(x-n,y,x,y,length=0.1)}; if(v=="N") {y <- y+n; arrows(x,y-n,x,y,length=0.1)}; if(v=="S") {y <- y-n; arrows(x,y+n,x,y,length=0.1)}; points(x,y,pch=19)}};