Determine the new position when moving from the current position in a given direction
move(curpos, dir, method = c("in.occupancy", "in.plane"))
new position in the occupancy matrix
current position (i, j) in the occupancy matrix
direction in which we move ("d", "u", "r" or "l")
choice of method ("in.occupancy" means the (current/new) position is given in terms of (row, column) indices in the occupancy matrix; "in.plane" means the directions are interpreted as in the (x,y)-plane).
Marius Hofert and Wayne Oldford