small changes
This commit is contained in:
@@ -15,7 +15,7 @@ import static java.lang.Math.*;
|
||||
* |isValidOrientation(getOrientation())
|
||||
* @invar The radius of the worm mus be a valid radius.
|
||||
* |isValidMinRadius(getRadius())
|
||||
* @invar The mass of the worm must be a valid mass.
|
||||
* @invar The mass of the worm must bef a valid mass.
|
||||
* |isValidMass(getMass())
|
||||
* @invar The value of the action points of the worm must be a valid value for action points.
|
||||
* |isValidValueActionPoints(getActionPoints())
|
||||
@@ -442,7 +442,7 @@ public class Worm {
|
||||
* substract the current points of the worm
|
||||
*
|
||||
* @param value
|
||||
* the value which should be substracted
|
||||
* the value which should be subtracted
|
||||
* @post the current points are set to the old current points minus the given value
|
||||
* |setActionPoints(getActionPoints() - value)
|
||||
*/
|
||||
@@ -582,8 +582,8 @@ public class Worm {
|
||||
if (cost > getActionPoints())
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
double distanceX = this.radius * cos(getOrientation());
|
||||
double distanceY = this.radius * sin(getOrientation());
|
||||
double distanceX = getRadius() * cos(getOrientation());
|
||||
double distanceY = getRadius() * sin(getOrientation());
|
||||
setLocation(Tuple.create(getLocation().item1 + numberSteps * distanceX,
|
||||
getLocation().item2 + numberSteps * distanceY));
|
||||
subtractActionPoints(cost);
|
||||
@@ -629,7 +629,7 @@ public class Worm {
|
||||
| (getActionPoints() - (long) ceil(toDegrees(angle) / 6) >= 0) )
|
||||
*/
|
||||
private boolean canTurn(double angle) {
|
||||
double currentAngle = this.getOrientation();
|
||||
double currentAngle = getOrientation();
|
||||
return 0 <= angle + currentAngle && angle + currentAngle < (2 * PI) &&
|
||||
!Double.isNaN(angle) &&
|
||||
getActionPoints() - (long) ceil(toDegrees(angle) / 6) >= 0;
|
||||
|
@@ -43,6 +43,8 @@ public class IllegalNameException extends RuntimeException {
|
||||
|
||||
/**
|
||||
* Return the index of this illegal name exception.
|
||||
*
|
||||
* @return this.index
|
||||
*/
|
||||
@Basic @Immutable
|
||||
public int getIndex() {
|
||||
@@ -51,6 +53,8 @@ public class IllegalNameException extends RuntimeException {
|
||||
|
||||
/**
|
||||
* Return the name of this illegal name exception.
|
||||
*
|
||||
* @return this.name
|
||||
*/
|
||||
@Basic @Immutable
|
||||
public String getName() {
|
||||
|
Reference in New Issue
Block a user