And what happen when the robot catched the ball?

Lets say after 10 iterations or diving, the robot catched the ball. You need to stop the iterator. I guess you add a new feature and test for it in that for loop?

Also this is a toy example - can you show example of real code? handling many states?

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockcode>
  • Lines and paragraphs break automatically.
  • You may post block code using <blockcode [type="language"]>...</blockcode> tags.
More information about formatting options