TetrisBot: Remove maxHeightWeigth from evaluation function.

This commit is contained in:
2019-11-08 02:09:04 +01:00
parent 64d7c9531b
commit 87c5878ec9

View File

@@ -164,11 +164,10 @@ namespace VAR.ScreenAutomation.Bots
private double EvaluateWorkingGrid()
{
return _workGrid.Evaluate(
aggregateHeightWeight: -0.6,
completeLinesWeight: 0.8,
holesWeight: -0.5,
bumpinessWeight: -0.2,
maxHeightWeight: -0.25);
aggregateHeightWeight: -0.510066,
completeLinesWeight: 0.760666,
holesWeight: -0.35663,
bumpinessWeight: -0.184483);
}
private const int ShowCooldownFrames = 2;
@@ -707,7 +706,7 @@ namespace VAR.ScreenAutomation.Bots
return complete;
}
public double Evaluate(double aggregateHeightWeight, double completeLinesWeight, double holesWeight, double bumpinessWeight, double maxHeightWeight)
public double Evaluate(double aggregateHeightWeight, double completeLinesWeight, double holesWeight, double bumpinessWeight)
{
// Calculte aggregate height
for (int i = 0; i < _gridWidth; i++)
@@ -750,16 +749,12 @@ namespace VAR.ScreenAutomation.Bots
bumpines += Math.Abs(_heights[i] - _heights[i - 1]);
}
// Calculate max height
int maxHeight = _heights.Max();
// Evaluate formula
double evaluationValue =
aggregateHeightWeight * agregateHeight +
completeLinesWeight * completeLines +
holesWeight * holes +
bumpinessWeight * bumpines +
maxHeightWeight * maxHeight +
0;
return evaluationValue;
}