Requirement – forward and backward moves

Now that we know where our ship is, let's try to move it. To begin with, we should be able to go both forwards and backwards.

Implement commands that move the ship forwards and backwards (f and b).

The Location helper class already has the forward and backward methods that implement this functionality:

public boolean forward() {
  ...
}

Get Test-Driven Java Development - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.