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