cs175:robocode_lab_-_distanceto_x_y_method
Robocode distanceTo Method
We want to write a Robocode method called distanceTo that gives us the distance from our robot to a set of x and y coordinates. The start of distanceTo is as follows:
/* * distanceTo: compute and return distance to a set of x,y coordinates * * inputs: double x, double y * output: return double distance from our robot to x, y */ public double distanceTo( double x, double y )
Define and test the distanceTo method in MethodBot1.
Note: We've calculated distance between x,y coordinates before in AdjustFireBot2 and CenterBot3.
cs175/robocode_lab_-_distanceto_x_y_method.txt · Last modified: 2014/11/04 21:21 by jchung