From 357487b7678f72cc91cb1b4708cf739dfbcff643 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Sat, 14 Aug 2021 20:07:38 -0700 Subject: [PATCH] Remove random purchase pessimization. Aircraft variety is now handled by explicit squadron selection, so no longer needed. --- game/procurement.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/game/procurement.py b/game/procurement.py index 0690cf39..559f5891 100644 --- a/game/procurement.py +++ b/game/procurement.py @@ -227,7 +227,6 @@ class ProcurementAi: def affordable_aircraft_for( self, request: AircraftProcurementRequest, airbase: ControlPoint, budget: float ) -> Optional[AircraftType]: - best_choice: Optional[AircraftType] = None for unit in aircraft_for_task(request.task_capability): if unit.price * request.number > budget: continue @@ -242,13 +241,9 @@ class ProcurementAi: if distance_to_target > unit.max_mission_range: continue - # Affordable, compatible, and we have a squadron capable of the task. To - # keep some variety, skip with a 50/50 chance. Might be a good idea to have - # the chance to skip based on the price compared to the rest of the choices. - best_choice = unit - if random.choice([True, False]): - break - return best_choice + # Affordable, compatible, and we have a squadron capable of the task. + return unit + return None def fulfill_aircraft_request( self, request: AircraftProcurementRequest, budget: float