Quote Originally Posted by eXeCuTeR View Post
Run it, it's hard to explain.
oh ok now I get it...

ei, ej is where the current position is. and -1 is the offset that you are trying to move. the if else tree is for one of four possible moves.