Playing with the weights

This commit is contained in:
Malte Tammena 2017-10-23 13:44:42 +02:00
parent 5016d07571
commit 8cab8c8deb

View file

@ -147,16 +147,16 @@ public class MalteAI implements Player{
} }
} }
// Maybe we get lucky TODO: Expand this. // Maybe we get lucky TODO: Expand this.
int nrOfMyIDAround = 0; double extraWeight = 0.0;
int nrOfEnemyIDAround = 0;
for (int i = 0; i < ids.length; i++) { for (int i = 0; i < ids.length; i++) {
if (ids[i] == this.id) { if (ids[i] == this.id) {
nrOfMyIDAround++; extraWeight += Math.pow(nrs[i], 2) * 2;
} else if (ids[i] == this.enemyID) { } else if (ids[i] == this.enemyID) {
nrOfEnemyIDAround++; extraWeight += Math.pow(nrs[i], 2);
} }
} }
weight *= 1.0 + (nrOfEnemyIDAround + nrOfMyIDAround) / (8.0 * 10.0); extraWeight /= 10 * 126;
weight *= extraWeight + 1.0;
return weight; return weight;
} }