1 public class Estimator {
12 public Estimator(int stages) {
17 this.probtable = new double[31];
19 this.probtable[i++] = 0.5000;
20 this.probtable[i++] = 0.5398;
21 this.probtable[i++] = 0.5793;
22 this.probtable[i++] = 0.6179;
23 this.probtable[i++] = 0.6554;
24 this.probtable[i++] = 0.6915;
25 this.probtable[i++] = 0.7257;
26 this.probtable[i++] = 0.7580;
27 this.probtable[i++] = 0.7881;
28 this.probtable[i++] = 0.8159;
29 this.probtable[i++] = 0.8413;
30 this.probtable[i++] = 0.8643;
31 this.probtable[i++] = 0.8849;
32 this.probtable[i++] = 0.9032;
33 this.probtable[i++] = 0.9192;
34 this.probtable[i++] = 0.9332;
35 this.probtable[i++] = 0.9452;
36 this.probtable[i++] = 0.9554;
37 this.probtable[i++] = 0.9641;
38 this.probtable[i++] = 0.9713;
39 this.probtable[i++] = 0.9772;
40 this.probtable[i++] = 0.9821;
41 this.probtable[i++] = 0.9861;
42 this.probtable[i++] = 0.9893;
43 this.probtable[i++] = 0.9918;
44 this.probtable[i++] = 0.9938;
45 this.probtable[i++] = 0.9953;
46 this.probtable[i++] = 0.9965;
47 this.probtable[i++] = 0.9974;
48 this.probtable[i++] = 0.9981;
49 this.probtable[i++] = 0.9987;
54 public boolean estimate(int time, double variance2, boolean fake) {
57 this.variance += variance2;
62 if(this.stages == 0) {
63 //System.printString("variance2: " + (int)(this.variance*100) + "(/100); ");
64 this.variance = Math.sqrt(this.variance);
65 //System.printString("variance: " + (int)(this.variance*100) + "(/100)\n");
71 public double getProbability(int x, int y) {
79 double prob = prob(r) - prob(l);
83 private double prob(int s) {
84 int tmp = (int)((s - this.time) * 10 / this.variance);
85 //System.printString(tmp + "\n");
86 int abs = (int)Math.abs(tmp);
88 if(abs > this.probtable.length - 1) {
91 prob = this.probtable[abs];
100 public int getTime() {
104 public double getVariance() {
105 return this.variance;
108 public boolean isPartial() {