Since you have a grid, I presume you are required to move along the grid lines. That is, from (5,5) you can move directly to (6,5), or (4,5), or (5,6) or (5, 4). You could not move directly from (5, 5) to (6, 6) though you could move from (5, 5) to (6, 5) and then to (6, 6), doing it in two moves.
Your "facing direction", then must be a multiple of 90 degrees. 0 degrees would be from (5, 5) to (6, 5), 180 degrees would be from (5, 5) to (5, 4), 270 degrees would be from (5,5) to (4,5), and 360 degrees would be from (5,5) to (5, 6). Since sin(90)= 1, sin(180)= 0, sin(270)= -1, sin(360)= 0 and cos(90)= 0, cos(180)= -1, cos(270)= 0, and cos(360)= 1, we can write a move of one step in direction \(\displaystyle \theta\), were \(\displaystyle theta\) is 90, 180, 270, or 360, as from \(\displaystyle (x, y)\) to \(\displaystyle (x+ sin(\theta), y+ cos(\theta))\).
Another way to do it would be to take \(\displaystyle \theta\) fixed at 90 degrees and i from 1 to 4. Then the four moves would be from \(\displaystyle (x, y)\) to \(\displaystyle (x+ cos(i*\theta), y+ sin(i*\theta)\).