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") x <- 9; y <- 12; rect(x-2.5,y-1.5,x+2.5,y+1.5,,col="yellow") symbols(5, 3, circles=1.5, inches=FALSE, add=TRUE, bg="yellow") symbols(4, 7, circles=1.5, inches=FALSE, add=TRUE, bg="yellow") symbols(8, 8, circles=1.5, inches=FALSE, add=TRUE, bg="yellow") text(4,7,"A"); text(5,3,"B"); text(8,8,"C"); text(9,12,"D") points(5,10,pch=19); x <- 5; y <- 10 via <- function() { 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)}};