/// <summary> /// Evaluates a cell for desirability /// </summary> /// <param name="context">The game context</param> /// <param name="cell">The cell to evaluate</param> /// <returns>Gets a numeric score for the cell under evaluation</returns> protected override decimal ScoreCell(GameContext context, GameCell cell) { var score = 0; // Main criteria is distance from nearest enemy _enemies.Each(e => score += e.Pos.CalculateDistanceInMovesFrom(cell.Pos) * 5); // Score the cell by its proximity to openness so the actors will avoid boxing themselves into a corner score += cell.FilterAdjacentCells(context, cells => cells.Where(c => !c.HasObstacle)).Count(); return(score); }