TorusAgent implements ILocated2D { public void move(int dx, int dy) { x = world.boundX(x + dx); y = world.boundY(y + dy); } TorusAgent(TorusWorld world, int startX, int startY, int type); int getAgentType(); @Override Tuple2D getPosition(); @Override double distance(ILocated2D other); @Override double getX(); @Override double getY(); void move(int dx, int dy); Color getColor(); boolean isCoLocated(TorusAgent other); boolean isCoLocated(TorusAgent[] others); TorusAgent closestAgent(TorusAgent[] others); double[] distances(TorusAgent[] others); double shortestXOffset(TorusAgent torusAgent); double shortestYOffset(TorusAgent torusAgent);  }
@Test public void testMove() { assertEquals(prey.getPosition(), new Tuple2D(0, 0)); prey.move(5, 17); assertEquals(prey.getPosition(), new Tuple2D(5, 17)); prey.move(3, 1); assertEquals(prey.getPosition(), new Tuple2D(8, 18)); prey.move(-13, -8); assertEquals(prey.getPosition(), new Tuple2D(95, 10)); prey.move(5, 110); assertEquals(prey.getPosition(), new Tuple2D(0, 20)); assertEquals(pred.getPosition(), new Tuple2D(0, 0)); pred.move(5, 17); assertEquals(pred.getPosition(), new Tuple2D(5, 17)); pred.move(3, 1); assertEquals(pred.getPosition(), new Tuple2D(8, 18)); pred.move(-13, -8); assertEquals(pred.getPosition(), new Tuple2D(95, 10)); pred.move(5, 110); assertEquals(pred.getPosition(), new Tuple2D(0, 20)); }