private double EvaluatorDribble() { double evaluation = 0; // bonus for proximity to enemy goal (0,e-1). Vector2d goalPosition = Constants.Uprights[0]; //upper-left post if (!_owner.Team.AttackingLeft) { goalPosition = Constants.Uprights[2]; //upper-right post } Vector2d goalVector = goalPosition - _owner.PositionDouble; double maxShotDistance = 2000; if (goalVector.Length() < maxShotDistance) { evaluation += (Math.Pow(Math.E, (1 - goalVector.Length() / maxShotDistance)) - 1); } // bonus for player being under little pressure InfluenceMap enemyMap = _owner.EnemyTeam.TeamInfluenceMap; double interdiction = enemyMap.SumInArea(_owner.PositionOnInfMap(), 3); if (interdiction < 3) { evaluation += (3 - interdiction); } // there should be a dominating bonus for players with good dribbling ability return(evaluation); }
/// <summary> /// Returns a double that measures the usefulness of a lob pass to passTarget /// </summary> private double EvaluatorPassLob(Footballer passTarget) { double evaluation = 0; Vector2d passVector = passTarget.PositionDouble - _owner.PositionDouble; // add bonus for long passes (0,1) evaluation += passVector.Length() / Constants.ActualXMax; // add bonus for going in the direction of enemy goal (0,1) Vector2d goalPosition = Constants.Uprights[0]; //upper-left post if (!_owner.Team.AttackingLeft) { goalPosition = Constants.Uprights[2]; //upper-right post } double angle = passVector.AngleBetween(goalPosition - _owner.PositionDouble); angle = Math.Abs(angle - Math.PI); evaluation += (angle / Math.PI); // add large bonus if target is alone. InfluenceMap enemyMap = _owner.EnemyTeam.TeamInfluenceMap; double interdiction = enemyMap.SumInArea(passTarget.PositionOnInfMap(), (UInt16)(passVector.Length() / (0.1 * Constants.ActualXMax) + 1)); if (interdiction < 1) { evaluation += 3; } return(evaluation); }