#Assignment:
Create a controller for a robot
Forward | ||
Left | 0 | Right |
Back |
##Requirements:
- Controller starts at rest, speed: 0, direction: none.
- Controller can issue four directional instructions (Forward, Back, Left, Right).
- When at rest, instructions to move in a certain direction will set direction to that direction and speed to 1.
- When moving, instructions to move in the same direction as currently moving increment speed in that direction by 1.
- When moving, instructions to move in the opposite direction as currently moving decrement speed by 1 until reaching 0, at which point the controller is now at rest, and the instructions for moving from rest apply.
- When moving, Instructions to move in a perpendicular direction to current direction will change direction to that direction and speed to 1.
- When moving, once reaching speed level four in a given direction further instructions to move in that direction return speed to 0 and directon to "none".
- Controller should be written so that the input and output can be varied independently of each other. For example I may want to drive the controller either programatically or manually and I may want to have it output to a console or a physical hardware device.