Improved the high and low count statistics by only including the last

high and low from 60 seconds ago.
This commit is contained in:
sigonasr2 2017-01-18 17:37:21 -06:00
parent 392e89a724
commit 6fb872b5ee
4 changed files with 12 additions and 4 deletions

Binary file not shown.

View File

@ -25,7 +25,7 @@ public enum ItemSet {
ALIKAHN(3,1, 15,6, 30,10, 1,1), ALIKAHN(3,1, 15,6, 30,10, 1,1),
LORASAADI(4,1, 4,2, 8,6, 8,3), LORASAADI(4,1, 4,2, 8,6, 8,3),
MOONSHADOW(4,2, 1,1, 8,8, 15,7), MOONSHADOW(4,2, 1,1, 8,8, 15,7),
GLADOMAIN(1,1, 12,10, 8,8, 1,1), GLADOMAIN(1,1, 12,4, 8,4, 1,1),
WOLFSBANE(2,1, 15,10, 10,5, 15,10), WOLFSBANE(2,1, 15,10, 10,5, 15,10),
ALUSTINE(3,2, 300,-30, 50,-5, 6,2), ALUSTINE(3,2, 300,-30, 50,-5, 6,2),
DASHER(5,5, 3,3, 5,5, 0,0), DASHER(5,5, 3,3, 5,5, 0,0),

View File

@ -7,6 +7,8 @@ public class Average {
int low; int low;
int trend; int trend;
int last; int last;
int lasthigh;
int lastlow;
public Average() { public Average() {
this.avg=0; this.avg=0;
this.count=0; this.count=0;
@ -17,11 +19,15 @@ public class Average {
} }
public void add(int value) { public void add(int value) {
if (lasthigh>60) {high=0;lasthigh=0;}
if (lastlow>60) {low=Integer.MAX_VALUE;lastlow=0;}
if (value>high) { if (value>high) {
high=value; high=value;
lasthigh=0;
} else } else
if (value<low) { if (value<low) {
low=value; low=value;
lastlow=0;
} }
last=value; last=value;
int curravg = avg; int curravg = avg;
@ -29,6 +35,8 @@ public class Average {
trend += Math.signum(avg-curravg); trend += Math.signum(avg-curravg);
if (trend>60) {trend=60;} if (trend>60) {trend=60;}
if (trend<-60) {trend=-60;} if (trend<-60) {trend=-60;}
lasthigh++;
lastlow++;
count++; count++;
} }
} }