Try to program without any 'if' help us to program on Open/closed principle.
Your mission is to program a rover. The rover need to move. A rover is on map with axis X and Y. It have a oriantation : north, south, east and west. Exemple : X = 0, Y = 0, Oriantation = North
-------
| | | |
-------
|^| | |
-------
- Rover need to rotate to the left. Exemple:*
-------
| | | |
-------
|<| | |
-------
- Rover need to rotate to the right. Exemple:
-------
| | | |
-------
|^| | |
-------
- Rover can move. Exemple:
-------
|^| | |
-------
| | | |
-------
- Rover can move back. Exemple:
-------
| | | |
-------
|^| | |
-------
- Rover can do 1,2,3 and 4 multiple time. Exemple:
-------
| | | |
-------
|>| | |
-------
- Rove can move to left. Exemple:
-------
|>| | |
-------
| | | |
-------
- Rove can move to right. Exemple:
-------
| | | |
-------
|>| | |
-------