Archived
0

use formula for compute CC

This commit is contained in:
Mo
2016-12-03 16:02:06 +03:00
parent b982685697
commit a543c216a4
2 changed files with 1 additions and 41 deletions

View File

@@ -108,22 +108,8 @@ public interface Place extends Connectable<Place> {
return distance * distance * 0.001 + 20.5; return distance * distance * 0.001 + 20.5;
} }
//возможно log(0.32 * Население)
static long[] CCgroups = new long[]{0,0,0,3_140,31_530,316_000,3_160_000,31_620_000,320_000_000,3_162_000_000L};
default long computeCC(){ default long computeCC(){
return computeCC(CCgroups); return Math.round(Math.log10(getPopulation())+1);
} }
default long computeCC(long[] CCgroups){
long population = getPopulation();
if (population == 0) return 0;
for (int i = 0; i < CCgroups.length; i++) {
long minPop = CCgroups[i];
if (population < minPop){
return i+1;
}
}
return CCgroups.length+1;
}
} }

View File

@@ -25,7 +25,6 @@ public class Profile {
private double rechargeTime; private double rechargeTime;
private double fuelPrice; private double fuelPrice;
private PATH_PRIORITY pathPriority; private PATH_PRIORITY pathPriority;
private long[] CCgroups;
public Profile(Ship ship) { public Profile(Ship ship) {
this.ship = ship; this.ship = ship;
@@ -42,7 +41,6 @@ public class Profile {
jumpTime = 32; jumpTime = 32;
rechargeTime = 12; rechargeTime = 12;
pathPriority = PATH_PRIORITY.FAST; pathPriority = PATH_PRIORITY.FAST;
CCgroups = Place.CCgroups;
} }
protected Profile(Profile profile){ protected Profile(Profile profile){
@@ -65,7 +63,6 @@ public class Profile {
this.system = profile.system; this.system = profile.system;
this.station = profile.station; this.station = profile.station;
this.ship = Ship.clone(profile.ship); this.ship = Ship.clone(profile.ship);
this.CCgroups = profile.CCgroups;
} }
public String getName() { public String getName() {
@@ -220,14 +217,6 @@ public class Profile {
this.pathPriority = pathPriority; this.pathPriority = pathPriority;
} }
public long[] getCCgroups() {
return CCgroups;
}
public void setCCgroups(long[] CCgroups) {
this.CCgroups = CCgroups;
}
public static Profile readFrom(Properties values, Market market){ public static Profile readFrom(Properties values, Market market){
Ship ship = Ship.readFrom(values); Ship ship = Ship.readFrom(values);
Profile profile = new Profile(ship); Profile profile = new Profile(ship);
@@ -260,15 +249,6 @@ public class Profile {
profile.setTakeoffTime(Double.valueOf(values.getProperty("profile.search.times.takeoff", "40"))); profile.setTakeoffTime(Double.valueOf(values.getProperty("profile.search.times.takeoff", "40")));
profile.setJumpTime(Double.valueOf(values.getProperty("profile.search.times.jump", "32"))); profile.setJumpTime(Double.valueOf(values.getProperty("profile.search.times.jump", "32")));
profile.setRechargeTime(Double.valueOf(values.getProperty("profile.search.times.recharge", "12"))); profile.setRechargeTime(Double.valueOf(values.getProperty("profile.search.times.recharge", "12")));
v = values.getProperty("profile.powerplay.cc", null);
if (v != null){
String[] strings = v.split(",");
long[] cc = new long[strings.length];
for (int i = 0; i < strings.length; i++) {
cc[i] = Long.valueOf(strings[i]);
}
profile.setCCgroups(cc);
}
return profile; return profile;
} }
@@ -290,12 +270,6 @@ public class Profile {
values.setProperty("profile.search.times.takeoff", String.valueOf(takeoffTime)); values.setProperty("profile.search.times.takeoff", String.valueOf(takeoffTime));
values.setProperty("profile.search.times.jump", String.valueOf(jumpTime)); values.setProperty("profile.search.times.jump", String.valueOf(jumpTime));
values.setProperty("profile.search.times.recharge", String.valueOf(rechargeTime)); values.setProperty("profile.search.times.recharge", String.valueOf(rechargeTime));
StringBuilder builder = new StringBuilder();
for (long cc : CCgroups) {
if (builder.length() > 0) builder.append(",");
builder.append(cc);
}
values.setProperty("profile.powerplay.cc", builder.toString());
ship.writeTo(values); ship.writeTo(values);
} }