some changes to worm
This commit is contained in:
@@ -13,9 +13,11 @@ public class Worm {
|
|||||||
private double minRadius;
|
private double minRadius;
|
||||||
// mass
|
// mass
|
||||||
private double mass;
|
private double mass;
|
||||||
|
private final int rho = 1062;
|
||||||
|
|
||||||
// points
|
// points
|
||||||
private double points;
|
private int points;
|
||||||
|
private int maxPoints;
|
||||||
|
|
||||||
// name
|
// name
|
||||||
private final String name;
|
private final String name;
|
||||||
@@ -103,6 +105,7 @@ public class Worm {
|
|||||||
|
|
||||||
public void setRadius(double radius) {
|
public void setRadius(double radius) {
|
||||||
this.radius = radius;
|
this.radius = radius;
|
||||||
|
setMass(radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getMinRadius() {
|
public double getMinRadius() {
|
||||||
@@ -117,19 +120,26 @@ public class Worm {
|
|||||||
return this.mass;
|
return this.mass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMass(double mass) {
|
private void setMass(double radius) {
|
||||||
|
|
||||||
|
double mass = this.rho * (4 / 3 * Math.PI * Math.pow(radius, 3));
|
||||||
|
|
||||||
this.mass = mass;
|
this.mass = mass;
|
||||||
|
setMaxPoints(mass);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getPoints() {
|
public int getPoints() {
|
||||||
return this.points;
|
return this.points;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPoints(double points) {
|
public void setPoints(int points) {
|
||||||
this.points = points;
|
this.points = points;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
private void setMaxPoints(double maxPoints) {
|
||||||
|
this.maxPoints = (int) Math.round(maxPoints);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user