Exercise 2:

Title: Path Finder


Find the movement pattern for 'P' to get to 'X'.
You need to write how much fields should 'P' needs to move Up, Down, Left or Right to get to 'X'.


Example:


Up: 0
Down: 8
Left: 0
Right: 8

P - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - -
- - - - - - - - X -
- - - - - - - - - -

Explanation:
'P' needs to go Down: 8 fields, and then it needs to go Right: 8 fields.

Download the source code here


Comment:

Sorry that I am diverting from C++, but this is cool Exercise to show you.