From 089500fcb40850153a408e6cb01474ded09ee91a Mon Sep 17 00:00:00 2001 From: "Valeriano A.R" Date: Sun, 10 Nov 2019 18:33:24 +0100 Subject: [PATCH] TetrisGrid: Put default weights on Evaluate method parameters. --- VAR.ScreenAutomation/Bots/TetrisBot.cs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/VAR.ScreenAutomation/Bots/TetrisBot.cs b/VAR.ScreenAutomation/Bots/TetrisBot.cs index 5788906..efa2d83 100644 --- a/VAR.ScreenAutomation/Bots/TetrisBot.cs +++ b/VAR.ScreenAutomation/Bots/TetrisBot.cs @@ -132,7 +132,7 @@ namespace VAR.ScreenAutomation.Bots if (_currentShape[rotation].Drop(_workGrid0, x, _shapeY, TetrisGrid.CellShapeA)) { - double newEvaluation = EvaluateWorkingGrid(); + double newEvaluation = _workGrid0.Evaluate(); _columnEvaluation[x] = newEvaluation; } else @@ -162,15 +162,6 @@ namespace VAR.ScreenAutomation.Bots } } - private double EvaluateWorkingGrid() - { - return _workGrid0.Evaluate( - aggregateHeightWeight: -0.510066, - completeLinesWeight: 0.760666, - holesWeight: -0.35663, - bumpinessWeight: -0.184483); - } - private const int ShotCooldownFrames = 2; private int _shotCooldown = ShotCooldownFrames; @@ -748,7 +739,11 @@ namespace VAR.ScreenAutomation.Bots return complete; } - public double Evaluate(double aggregateHeightWeight, double completeLinesWeight, double holesWeight, double bumpinessWeight) + public double Evaluate( + double aggregateHeightWeight = -0.510066, + double completeLinesWeight = 0.760666, + double holesWeight = -0.35663, + double bumpinessWeight = -0.184483) { // Calculte aggregate height for (int i = 0; i < _gridWidth; i++)