internal ManeuverResponse DecideWhereToManeuver(ManeuverRequest maneuverRequest) { ManeuverResponse response = new ManeuverResponse(); IEnumerable <BoardTerritory> myTerritories = GetMyTerritories(maneuverRequest.Board); BoardTerritory fromTerritory = new BoardTerritory(); fromTerritory.Armies = 0; foreach (BoardTerritory territory in myTerritories) { if (GetNumBadTerritories(territory, maneuverRequest.Board) == 0 && territory.Armies > fromTerritory.Armies) { fromTerritory = territory; } } if (fromTerritory.Armies == 0) { response.Decide = false; } else { response.Decide = true; response.From = fromTerritory.Location; BoardTerritory toTerritory = new BoardTerritory(); int toScore = 999999; foreach (BoardTerritory territory in GetNeighbors(fromTerritory, maneuverRequest.Board)) { if (territory.Location.Column + territory.Location.Row < toScore) { toScore = territory.Location.Column + territory.Location.Row; toTerritory = territory; } } response.To = toTerritory.Location; } return(response); }