Robot Game

Consider a robot moving in an environment consisting of 5x5 cells. The robot can either be rotated or moved forward for a certain distance. The environment in which the robot moves is bounded by walls - so if you try to move the robot out of the area it will stop at the grid besides the wall.
Let the lower left grid be 1/1 and the upper right grid be 5/5. The coordinates are given in X/Y form, the X direction is upwards and Y from left to right.
The robot starts in the middle of the field (3/3) with its orientation in positive X direction.
Possible actions for the robot are defined by the numbers 1-5:
1 --> turn clockwise 90 degrees
2 --> turn clockwise 180 degrees
3 --> move 3 grids forward
4 --> move 4 grids forward
5 --> move 5 grids forward

If an illegal command is given (a number different than [1-5]) the command should be ignored.

Write a program that will read 3 commands and print the robots position and orientation after moving according to each command.
Input:
Operation1 Operation2 Operation3

Output:
Position_X_first_round Position_Y_first_round Orientation_first_round
Position_X_second_round Position_Y_second_round Orientation_second_round
Position_X_third_round Position_Y_third_round Orientation_third_round

For the output let the orientation be defined as 0 for being oriented in positive X direction, 1 for positive Y direction, 2 negative X direction and 3 negative Y direction.

Example1
Input:
2 5 3

Output:
3 3 2
1 3 2
1 3 2

Example2
Input:
3 1 4

Output:
5 3 0
5 3 1
5 5 1

Everyone can help me withis coding...I tried but i won't come out whith the good code...Please help me with this..

1 answer

Post your code and we can help.
State the language and the make and version of the compiler, if you use any.
Similar Questions
  1. 1. Who is Aibo?2. He is a robot dog. 3. It is a robot dog. 4. What is Aibo? 5. He is a robot dog. 6. It is a robot dog. (Are the
    1. answers icon 1 answer
  2. How is the ending of the story an example of situational irony?Responses They expected the robot to be an actual robot. They
    1. answers icon 1 answer
    1. answers icon 2 answers
  3. The Robot Brain functions as:A. An energy source for the robot B. The core processing unit of a robot C. A safety device for
    1. answers icon 1 answer
more similar questions