瀏覽代碼

ColoScript2: Catching 0 empty holds

 If we have 0 empty that means we can't move people.

 Example #1
 Total Holds: 100 - Fuel Ore=13, Organics=40, Equipment=47
 Now we will catch this!
 Example #2
 Total Holds: 100 - Fuel Ore=13, Empty=87
 Still won't let you run, to maximize colonists moved per turns used.
david 5 年之前
父節點
當前提交
989c2fdd22
共有 1 個文件被更改,包括 249 次插入196 次删除
  1. 249 196
      flexible.py

+ 249 - 196
flexible.py

@@ -3228,6 +3228,7 @@ class ColoScript2(object):
             work = line[16:].replace("-", "").replace("=", " ").split()
             self.total_holds = int(work[0])
             count = 0
+            seen_empty = False
             for w in work:
                 if w != "Empty":
                     count += 1
@@ -3237,6 +3238,7 @@ class ColoScript2(object):
                     log.debug("EMPTY HOLDS = {0}".format(self.holds))
                     self.holds_percent = int((self.holds / self.total_holds) * 100.0)
                     log.debug("HOLDS PERCENT = {0}%".format(self.holds_percent))
+                    seen_empty = True
                     if self.holds < self.total_holds:
                         self.send2player(
                             "\r"
@@ -3247,6 +3249,16 @@ class ColoScript2(object):
                             )
                         )
                         self.deactivate(True)
+            if (
+                seen_empty != True
+            ):  # Just incase we didn't see Empty... meaning we have 0 avalible holds
+                self.send2player(
+                    "\r"
+                    + Boxes.alert(
+                        "You need {0} holds empty! (0 Empty)".format(self.total_holds)
+                    )
+                )
+                self.deactivate(True)
         if "There aren't that many on the planet!" in line:
             self.send2player("\r" + Boxes.alert("We're missing people!"))
             self.deactivate(True)
@@ -3304,12 +3316,12 @@ class ColoScript2(object):
                 )
                 # Ok, there's going to have to be some sort of modifier (K, M, etc.)
                 # to these numbers.  Beware!
-                self.planets[number]['ore'] = details[5]
-                self.planets[number]['org'] = details[6]
-                self.planets[number]['equ'] = details[7]
-                #self.planets[number]['cit'] = details[9] # This is if we wanted cit money... but that's not it
+                self.planets[number]["ore"] = details[5]
+                self.planets[number]["org"] = details[6]
+                self.planets[number]["equ"] = details[7]
+                # self.planets[number]['cit'] = details[9] # This is if we wanted cit money... but that's not it
+
 
-    
 class MaxFighterMake(object):
     """ Max Fighter Make
 
@@ -3322,6 +3334,7 @@ class MaxFighterMake(object):
         6 = if bad then try cat 2 to cat 3 (Or perhaps this defaults to false if cat 3 is N/A)
         7 = loop back to state 3 until all result in bad (Yay best acheived)
     """
+
     def __init__(self, game):
         self.game = game
         self.queue_game = game.queue_game
@@ -3334,21 +3347,21 @@ class MaxFighterMake(object):
         # My "stuff" in my pants!
         self.state = 1
         self.corp = True
-        self.target_sector = 0 # Sector Number of target
-        self.target_number = 0 # Planet Number of target
-        self.last_seen = {'Ore': False, 'Org': False, 'Equ': False, 'Fig': False}
+        self.target_sector = 0  # Sector Number of target
+        self.target_number = 0  # Planet Number of target
+        self.last_seen = {"Ore": False, "Org": False, "Equ": False, "Fig": False}
         self.max_product = 0
-        self.trying = 'Ore2Org'
+        self.trying = "Ore2Org"
         self.trying_NEXT = False
         self.movement = 1000
 
-        self.planets_list = [] # Will be a list of dicts, containing planet information
-        self.cap = False # Capture line for planet
-        
+        self.planets_list = []  # Will be a list of dicts, containing planet information
+        self.cap = False  # Capture line for planet
+
         # Activate
         self.prompt = game.buffer
         self.save = self.observer.save()
-        self.observer.connect('player', self.player)
+        self.observer.connect("player", self.player)
         self.observer.connect("prompt", self.game_prompt)
         self.observer.connect("game-line", self.game_line)
         self.ore = {}
@@ -3369,14 +3382,14 @@ class MaxFighterMake(object):
         self.state = 0
         log.debug("ColoScript2.deactivate()")
         self.game.to_player = True
-        assert(not self.save is None)
+        assert not self.save is None
         self.observer.load(self.save)
         self.save = None
         if self.defer:
             if andExit:
-                self.defer.callback({'exit':True})
+                self.defer.callback({"exit": True})
             else:
-                self.defer.callback('done')
+                self.defer.callback("done")
             self.defer = None
 
     def player(self, chunk: bytes):
@@ -3391,7 +3404,7 @@ class MaxFighterMake(object):
         self.queue_game.put(txt)
 
     def target_chosen(self, choice: str):
-        if choice.strip() == '':
+        if choice.strip() == "":
             self.deactivate(True)
         else:
             self.target_number = int(choice)
@@ -3403,10 +3416,10 @@ class MaxFighterMake(object):
 
     def check_resource(self, resource):
         # Given a valid string that can be converted to int
-        if resource == 'N/A':
+        if resource == "N/A":
             resource = -1
         else:
-            resource = int(resource.replace(',', ''))
+            resource = int(resource.replace(",", ""))
         return resource
 
     def game_prompt(self, prompt: str):
@@ -3416,87 +3429,94 @@ class MaxFighterMake(object):
             if len(self.planets_list) == 0:
                 self.send2player(self.nl + Boxes.alert("No planets in this sector!"))
                 self.deactivate(True)
-        
+
             tc = merge(Style.BRIGHT + Fore.YELLOW + Back.BLUE)
             c1 = merge(Style.BRIGHT + Fore.WHITE + Back.BLUE)
             c2 = merge(Style.BRIGHT + Fore.CYAN + Back.BLUE)
 
             box = Boxes(44, color=tc)
             self.queue_game.put(box.top())
-            self.queue_game.put(box.row(tc + "{0:3} {1:20} {2:18} ".format(" # ", "Planet Name", "Planet Type")))
+            self.queue_game.put(
+                box.row(
+                    tc
+                    + "{0:3} {1:20} {2:18} ".format(" # ", "Planet Name", "Planet Type")
+                )
+            )
             self.queue_game.put(box.middle())
 
             def planet_output(num, planet_name, planet_type):
-                row = "{0}{1:3} {2}{3:29} {4:9} ".format(c1, num, c2, planet_name, planet_type)
+                row = "{0}{1:3} {2}{3:29} {4:9} ".format(
+                    c1, num, c2, planet_name, planet_type
+                )
                 self.send2player(box.row(row))
-            
+
             self.total = 0
             for p in self.planets_list:
-                planet_output(self.total, p['name'], p['type'])
+                planet_output(self.total, p["name"], p["type"])
                 self.total += 1
-            
+
             ask = PlayerInput(self.game)
             d = ask.prompt("Choose a planet", 3, name="planet", digits=True)
             d = d.addCallback(self.target_chosen)
         elif self.state == 4:
             if prompt.startswith("Planet command (?=help) [D]"):
-                self.send2game('?')
+                self.send2game("?")
                 self.state = 6
         elif self.state == 6:
             if prompt.startswith("Planet command (?=help) [D]"):
-                self.send2game('P')
+                self.send2game("P")
                 self.state = 7
         elif self.state == 7:
             if prompt.startswith("Display planet?"):
-                self.send2game('N')
+                self.send2game("N")
                 self.state = 8
         elif self.state == 8:
             if prompt.startswith("(1)Ore, (2)Org or (3)Equipment?"):
-                if self.trying == 'Ore2Org' or self.trying == 'Ore2Equ':
-                    self.send2game('1')
-                elif self.trying == 'Org2Equ' or self.trying == 'Org2Ore':
-                    self.send2game('2')
-                elif self.trying == 'Equ2Org' or self.trying == 'Equ2Ore':
-                    self.send2game('3')
+                if self.trying == "Ore2Org" or self.trying == "Ore2Equ":
+                    self.send2game("1")
+                elif self.trying == "Org2Equ" or self.trying == "Org2Ore":
+                    self.send2game("2")
+                elif self.trying == "Equ2Org" or self.trying == "Equ2Ore":
+                    self.send2game("3")
                 self.state = 9
         elif self.state == 9:
             if prompt.startswith("How many groups of Colonists do you want to move?"):
-                self.send2game('{0}\r'.format(self.movement))
+                self.send2game("{0}\r".format(self.movement))
                 self.state = 10
         elif self.state == 10:
             if prompt.startswith("(1)Ore, (2)Org or (3)Equipment?"):
-                if self.trying == 'Org2Ore' or self.trying == 'Equ2Ore':
-                    self.send2game('1')
-                elif self.trying == 'Ore2Org' or self.trying == 'Equ2Org':
-                    self.send2game('2')
-                elif self.trying == 'Ore2Equ' or self.trying == 'Org2Equ':
-                    self.send2game('3')
+                if self.trying == "Org2Ore" or self.trying == "Equ2Ore":
+                    self.send2game("1")
+                elif self.trying == "Ore2Org" or self.trying == "Equ2Org":
+                    self.send2game("2")
+                elif self.trying == "Ore2Equ" or self.trying == "Org2Equ":
+                    self.send2game("3")
                 self.state = 11
         elif self.state == 11:
-            if prompt.startswith('Planet command (?=help) [D]'):
-                self.send2game('D')
+            if prompt.startswith("Planet command (?=help) [D]"):
+                self.send2game("D")
                 self.trying_NEXT = False
-                self.last_seen['Ore'] = False
-                self.last_seen['Org'] = False
-                self.last_seen['Equ'] = False
-                self.last_seen['Fig'] = False
+                self.last_seen["Ore"] = False
+                self.last_seen["Org"] = False
+                self.last_seen["Equ"] = False
+                self.last_seen["Fig"] = False
                 self.state = 12
         elif self.state == 12:
-            if prompt.startswith('Planet command (?=help) [D]'):
-                self.send2game('?')
+            if prompt.startswith("Planet command (?=help) [D]"):
+                self.send2game("?")
                 self.state = 6
-            #if(self.trying == 'Ore2Org'):
+            # if(self.trying == 'Ore2Org'):
             #    self.send2game('P\r1{0}2D'.format(self.movement))
             #    self.state = 4
             #    # Back to looking at the planet
-            #elif(self.trying == 'Ore2Equ'):
+            # elif(self.trying == 'Ore2Equ'):
             #    self.send2game('P\r1{0}3D'.format(self.movement))
             #    self.state = 4
             #    # Back to looking at the planet
-            #elif(self.trying == 'Org2Equ'):
+            # elif(self.trying == 'Org2Equ'):
             #    self.send2game('P\r2{0}3D'.format(self.movement))
             #    self.state = 4
-            #elif(self.trying == 'reverse'):
+            # elif(self.trying == 'reverse'):
             #    if(self.trying_OLD == 'Ore2Org'):
             #        self.send2game('P\r2{0}1D'.format(self.movement))
             #    elif(self.trying_OLD == 'Ore2Equ'):
@@ -3509,27 +3529,36 @@ class MaxFighterMake(object):
     def game_line(self, line: str):
         log.debug("L {0} | {1}".format(self.state, line))
         # IF at any state we see turns left lets grab it
-        if 'turns left' in line:
-                work = line[19:].replace(' turns left.', '').strip()
-                self.turns = work
-                log.debug("TURNS LEFT: {0}".format(self.turns))
-                if int(self.turns) < 200:
-                    self.send2player("\r" + Boxes.alert("Low Turns! ({0})".format(self.turns)))
-                    self.deactivate(True)
+        if "turns left" in line:
+            work = line[19:].replace(" turns left.", "").strip()
+            self.turns = work
+            log.debug("TURNS LEFT: {0}".format(self.turns))
+            if int(self.turns) < 200:
+                self.send2player(
+                    "\r" + Boxes.alert("Low Turns! ({0})".format(self.turns))
+                )
+                self.deactivate(True)
         # IF at any state we see how many holds avalible let's get that
-        if 'Total Holds' in line:
-            work = line[16:].replace('-', '').replace('=', ' ').split()
+        if "Total Holds" in line:
+            work = line[16:].replace("-", "").replace("=", " ").split()
             self.total_holds = int(work[0])
             count = 0
             for w in work:
-                if(w != 'Empty'):
+                if w != "Empty":
                     count += 1
-                elif(w == 'Empty'):
+                elif w == "Empty":
                     count += 1
                     self.holds = int(work[count])
                     log.debug("EMPTY HOLDS = {0}".format(self.holds))
-                    if(self.holds < self.total_holds):
-                        self.send2player("\r" + Boxes.alert("You need {0} holds empty! ({1} Empty)".format(self.total_holds, self.holds)))
+                    if self.holds < self.total_holds:
+                        self.send2player(
+                            "\r"
+                            + Boxes.alert(
+                                "You need {0} holds empty! ({1} Empty)".format(
+                                    self.total_holds, self.holds
+                                )
+                            )
+                        )
                         self.deactivate(True)
         if "There aren't that many on the planet!" in line:
             self.send2player("\r" + Boxes.alert("We're missing people!"))
@@ -3537,179 +3566,203 @@ class MaxFighterMake(object):
         if "There isn't room on the planet for that many!" in line:
             self.send2player("\r" + Boxes.alert("We have to many people!"))
             self.deactivate(True)
-        
+
         # Now back to our scheduled program
         if self.state == 1:
             if line.startswith("Planets"):
                 self.cap = True
-                work = re.split(r'\s+', line)
-                #log.debug("'{0}'".format(work))
-                final = {'name': work[-1], 'type': work[-2]}
+                work = re.split(r"\s+", line)
+                # log.debug("'{0}'".format(work))
+                final = {"name": work[-1], "type": work[-2]}
                 self.planets_list.append(final)
-                log.debug("Planet {0} type {1}".format(final['name'], final['type']))
-            elif line.startswith("Ships"): # Stop 1, so we don't capture everything
+                log.debug("Planet {0} type {1}".format(final["name"], final["type"]))
+            elif line.startswith("Ships"):  # Stop 1, so we don't capture everything
                 self.cap = False
-            elif line.startswith("Fighters"): # Stop 2, so we don't capture everything
+            elif line.startswith("Fighters"):  # Stop 2, so we don't capture everything
                 self.cap = False
             elif self.cap == True:
-                work = re.split(r'\s+', line)
-                #log.debug("'{0}'".format(work))
-                final = {'name': work[-1], 'type': work[-2]}
+                work = re.split(r"\s+", line)
+                # log.debug("'{0}'".format(work))
+                final = {"name": work[-1], "type": work[-2]}
                 self.planets_list.append(final)
-                log.debug("Planet {0} type {1}".format(final['name'], final['type']))
+                log.debug("Planet {0} type {1}".format(final["name"], final["type"]))
             elif self.cap == False and len(self.planets_list) != 0:
                 self.state = 2
         elif self.state == 3:
-            if self.planets_list[self.target_number]['name'] in line:
-                work = re.split(r'\s+', line)
+            if self.planets_list[self.target_number]["name"] in line:
+                work = re.split(r"\s+", line)
                 log.debug("'{0}'".format(work))
-                pnumber = work[2].replace('>', '')
-                self.planets_list[self.target_number]['pnumber'] = pnumber # Add this to our dict of the planet
-                log.debug("Pnumber {0} is {1}".format(pnumber, self.planets_list[self.target_number]['name']))
+                pnumber = work[2].replace(">", "")
+                self.planets_list[self.target_number][
+                    "pnumber"
+                ] = pnumber  # Add this to our dict of the planet
+                log.debug(
+                    "Pnumber {0} is {1}".format(
+                        pnumber, self.planets_list[self.target_number]["name"]
+                    )
+                )
                 self.send2game("{0}\r".format(pnumber))
                 self.state = 4
         elif self.state == 4:
-            # Item    Colonists  Colonists    Daily     Planet      Ship      Planet  
-            #          (1000s)   2 Build 1   Product    Amount     Amount     Maximum 
+            # Item    Colonists  Colonists    Daily     Planet      Ship      Planet
+            #          (1000s)   2 Build 1   Product    Amount     Amount     Maximum
             # -------  ---------  ---------  ---------  ---------  ---------  ---------
             # Fuel Ore        707          2        353     10,376          0    200,000
             # Organics        651          5        130      4,304          0    200,000
             # Equipment     1,641         20         82      2,618          0    100,000
             # Fighters        N/A         63         47      1,463        400  1,000,000
-            if line.startswith('Fuel Ore'):
-                work = re.split(r'\s+', line)
-                #log.debug("Ore - Pop: {0}, 2make1: {1} dailyproduct: {2} pamount: {3} saamount: {4} pmax: {5}".format(work[2], work[3], work[4], work[5], work[6], work[7]))
+            if line.startswith("Fuel Ore"):
+                work = re.split(r"\s+", line)
+                # log.debug("Ore - Pop: {0}, 2make1: {1} dailyproduct: {2} pamount: {3} saamount: {4} pmax: {5}".format(work[2], work[3], work[4], work[5], work[6], work[7]))
                 self.ore = {
-                    'pop': self.check_resource(work[2]),
-                    'make': self.check_resource(work[3]),
-                    'daily': self.check_resource(work[4]),
-                    'amount': self.check_resource(work[5]),
-                    'ship': self.check_resource(work[6]),
-                    'pmax': self.check_resource(work[7])
+                    "pop": self.check_resource(work[2]),
+                    "make": self.check_resource(work[3]),
+                    "daily": self.check_resource(work[4]),
+                    "amount": self.check_resource(work[5]),
+                    "ship": self.check_resource(work[6]),
+                    "pmax": self.check_resource(work[7]),
                 }
-                self.last_seen['Ore'] = True
-            elif line.startswith('Organics'):
-                work = re.split(r'\s+', line)
-                #log.debug("Org - Pop: {0}, 2make1: {1} dailyproduct: {2} pamount: {3} saamount: {4} pmax: {5}".format(work[1], work[2], work[3], work[4], work[5], work[6]))
+                self.last_seen["Ore"] = True
+            elif line.startswith("Organics"):
+                work = re.split(r"\s+", line)
+                # log.debug("Org - Pop: {0}, 2make1: {1} dailyproduct: {2} pamount: {3} saamount: {4} pmax: {5}".format(work[1], work[2], work[3], work[4], work[5], work[6]))
                 self.org = {
-                    'pop': self.check_resource(work[1]),
-                    'make': self.check_resource(work[2]),
-                    'daily': self.check_resource(work[3]),
-                    'amount': self.check_resource(work[4]),
-                    'ship': self.check_resource(work[5]),
-                    'pmax': self.check_resource(work[6])
+                    "pop": self.check_resource(work[1]),
+                    "make": self.check_resource(work[2]),
+                    "daily": self.check_resource(work[3]),
+                    "amount": self.check_resource(work[4]),
+                    "ship": self.check_resource(work[5]),
+                    "pmax": self.check_resource(work[6]),
                 }
-                self.last_seen['Org'] = True
-            elif line.startswith('Equipment'):
-                work = re.split(r'\s+', line)
-                #log.debug("Equ - Pop: {0}, 2make1: {1} dailyproduct: {2} pamount: {3} saamount: {4} pmax: {5}".format(work[1], work[2], work[3], work[4], work[5], work[6]))
+                self.last_seen["Org"] = True
+            elif line.startswith("Equipment"):
+                work = re.split(r"\s+", line)
+                # log.debug("Equ - Pop: {0}, 2make1: {1} dailyproduct: {2} pamount: {3} saamount: {4} pmax: {5}".format(work[1], work[2], work[3], work[4], work[5], work[6]))
                 self.equ = {
-                    'pop': self.check_resource(work[1]),
-                    'make': self.check_resource(work[2]),
-                    'daily': self.check_resource(work[3]),
-                    'amount': self.check_resource(work[4]),
-                    'ship': self.check_resource(work[5]),
-                    'pmax': self.check_resource(work[6])
+                    "pop": self.check_resource(work[1]),
+                    "make": self.check_resource(work[2]),
+                    "daily": self.check_resource(work[3]),
+                    "amount": self.check_resource(work[4]),
+                    "ship": self.check_resource(work[5]),
+                    "pmax": self.check_resource(work[6]),
                 }
-                self.last_seen['Equ'] = True
-            elif line.startswith('Fighters'):
-                work = re.split(r'\s+', line)
-                #log.debug("Fig - Pop: {0}, 2make1: {1} dailyproduct: {2} pamount: {3} saamount: {4} pmax: {5}".format(work[1], work[2], work[3], work[4], work[5], work[6]))
+                self.last_seen["Equ"] = True
+            elif line.startswith("Fighters"):
+                work = re.split(r"\s+", line)
+                # log.debug("Fig - Pop: {0}, 2make1: {1} dailyproduct: {2} pamount: {3} saamount: {4} pmax: {5}".format(work[1], work[2], work[3], work[4], work[5], work[6]))
                 self.fig = {
-                    'pop': self.check_resource(work[1]),
-                    'make': self.check_resource(work[2]),
-                    'daily': self.check_resource(work[3]),
-                    'amount': self.check_resource(work[4]),
-                    'ship': self.check_resource(work[5]),
-                    'pmax': self.check_resource(work[6])
-                }                
-                self.last_seen['Fig'] = True
+                    "pop": self.check_resource(work[1]),
+                    "make": self.check_resource(work[2]),
+                    "daily": self.check_resource(work[3]),
+                    "amount": self.check_resource(work[4]),
+                    "ship": self.check_resource(work[5]),
+                    "pmax": self.check_resource(work[6]),
+                }
+                self.last_seen["Fig"] = True
             else:
-                if self.last_seen['Ore'] == True and self.last_seen['Org'] == True and self.last_seen['Equ'] == True and self.last_seen['Fig'] == True:
-                    if self.fig['daily'] > self.max_product:
-                        self.max_product = self.fig['daily']
-                    
-                    self.planets_list[self.target_number]['Ore'] = self.ore
-                    self.planets_list[self.target_number]['Org'] = self.org
-                    self.planets_list[self.target_number]['Equ'] = self.equ
-                    self.planets_list[self.target_number]['Fig'] = self.fig
+                if (
+                    self.last_seen["Ore"] == True
+                    and self.last_seen["Org"] == True
+                    and self.last_seen["Equ"] == True
+                    and self.last_seen["Fig"] == True
+                ):
+                    if self.fig["daily"] > self.max_product:
+                        self.max_product = self.fig["daily"]
+
+                    self.planets_list[self.target_number]["Ore"] = self.ore
+                    self.planets_list[self.target_number]["Org"] = self.org
+                    self.planets_list[self.target_number]["Equ"] = self.equ
+                    self.planets_list[self.target_number]["Fig"] = self.fig
                     log.debug("Max Production is {0}!".format(self.max_product))
                     self.state == 6
         elif self.state == 12:
-            if line.startswith('Fuel Ore'):
-                work = re.split(r'\s+', line)
-                #log.debug("Ore - Pop: {0}, 2make1: {1} dailyproduct: {2} pamount: {3} saamount: {4} pmax: {5}".format(work[2], work[3], work[4], work[5], work[6], work[7]))
+            if line.startswith("Fuel Ore"):
+                work = re.split(r"\s+", line)
+                # log.debug("Ore - Pop: {0}, 2make1: {1} dailyproduct: {2} pamount: {3} saamount: {4} pmax: {5}".format(work[2], work[3], work[4], work[5], work[6], work[7]))
                 self.ore = {
-                    'pop': self.check_resource(work[2]),
-                    'make': self.check_resource(work[3]),
-                    'daily': self.check_resource(work[4]),
-                    'amount': self.check_resource(work[5]),
-                    'ship': self.check_resource(work[6]),
-                    'pmax': self.check_resource(work[7])
+                    "pop": self.check_resource(work[2]),
+                    "make": self.check_resource(work[3]),
+                    "daily": self.check_resource(work[4]),
+                    "amount": self.check_resource(work[5]),
+                    "ship": self.check_resource(work[6]),
+                    "pmax": self.check_resource(work[7]),
                 }
-                self.last_seen['Ore'] = True
-            elif line.startswith('Organics'):
-                work = re.split(r'\s+', line)
-                #log.debug("Org - Pop: {0}, 2make1: {1} dailyproduct: {2} pamount: {3} saamount: {4} pmax: {5}".format(work[1], work[2], work[3], work[4], work[5], work[6]))
+                self.last_seen["Ore"] = True
+            elif line.startswith("Organics"):
+                work = re.split(r"\s+", line)
+                # log.debug("Org - Pop: {0}, 2make1: {1} dailyproduct: {2} pamount: {3} saamount: {4} pmax: {5}".format(work[1], work[2], work[3], work[4], work[5], work[6]))
                 self.org = {
-                    'pop': self.check_resource(work[1]),
-                    'make': self.check_resource(work[2]),
-                    'daily': self.check_resource(work[3]),
-                    'amount': self.check_resource(work[4]),
-                    'ship': self.check_resource(work[5]),
-                    'pmax': self.check_resource(work[6])
+                    "pop": self.check_resource(work[1]),
+                    "make": self.check_resource(work[2]),
+                    "daily": self.check_resource(work[3]),
+                    "amount": self.check_resource(work[4]),
+                    "ship": self.check_resource(work[5]),
+                    "pmax": self.check_resource(work[6]),
                 }
-                self.last_seen['Org'] = True
-            elif line.startswith('Equipment'):
-                work = re.split(r'\s+', line)
-                #log.debug("Equ - Pop: {0}, 2make1: {1} dailyproduct: {2} pamount: {3} saamount: {4} pmax: {5}".format(work[1], work[2], work[3], work[4], work[5], work[6]))
+                self.last_seen["Org"] = True
+            elif line.startswith("Equipment"):
+                work = re.split(r"\s+", line)
+                # log.debug("Equ - Pop: {0}, 2make1: {1} dailyproduct: {2} pamount: {3} saamount: {4} pmax: {5}".format(work[1], work[2], work[3], work[4], work[5], work[6]))
                 self.equ = {
-                    'pop': self.check_resource(work[1]),
-                    'make': self.check_resource(work[2]),
-                    'daily': self.check_resource(work[3]),
-                    'amount': self.check_resource(work[4]),
-                    'ship': self.check_resource(work[5]),
-                    'pmax': self.check_resource(work[6])
+                    "pop": self.check_resource(work[1]),
+                    "make": self.check_resource(work[2]),
+                    "daily": self.check_resource(work[3]),
+                    "amount": self.check_resource(work[4]),
+                    "ship": self.check_resource(work[5]),
+                    "pmax": self.check_resource(work[6]),
                 }
-                self.last_seen['Equ'] = True
-            elif line.startswith('Fighters'):
-                work = re.split(r'\s+', line)
-                #log.debug("Fig - Pop: {0}, 2make1: {1} dailyproduct: {2} pamount: {3} saamount: {4} pmax: {5}".format(work[1], work[2], work[3], work[4], work[5], work[6]))
+                self.last_seen["Equ"] = True
+            elif line.startswith("Fighters"):
+                work = re.split(r"\s+", line)
+                # log.debug("Fig - Pop: {0}, 2make1: {1} dailyproduct: {2} pamount: {3} saamount: {4} pmax: {5}".format(work[1], work[2], work[3], work[4], work[5], work[6]))
                 self.fig = {
-                    'pop': self.check_resource(work[1]),
-                    'make': self.check_resource(work[2]),
-                    'daily': self.check_resource(work[3]),
-                    'amount': self.check_resource(work[4]),
-                    'ship': self.check_resource(work[5]),
-                    'pmax': self.check_resource(work[6])
-                }                
-                self.last_seen['Fig'] = True
+                    "pop": self.check_resource(work[1]),
+                    "make": self.check_resource(work[2]),
+                    "daily": self.check_resource(work[3]),
+                    "amount": self.check_resource(work[4]),
+                    "ship": self.check_resource(work[5]),
+                    "pmax": self.check_resource(work[6]),
+                }
+                self.last_seen["Fig"] = True
             else:
-                if self.last_seen['Ore'] == True and self.last_seen['Org'] == True and self.last_seen['Equ'] == True and self.last_seen['Fig'] == True:
-                    if self.fig['daily'] > self.max_product:
-                        self.max_product = self.fig['daily']
-                    
-                    self.planets_list[self.target_number]['Ore'] = self.ore
-                    self.planets_list[self.target_number]['Org'] = self.org
-                    self.planets_list[self.target_number]['Equ'] = self.equ
-                    self.planets_list[self.target_number]['Fig'] = self.fig
+                if (
+                    self.last_seen["Ore"] == True
+                    and self.last_seen["Org"] == True
+                    and self.last_seen["Equ"] == True
+                    and self.last_seen["Fig"] == True
+                ):
+                    if self.fig["daily"] > self.max_product:
+                        self.max_product = self.fig["daily"]
+
+                    self.planets_list[self.target_number]["Ore"] = self.ore
+                    self.planets_list[self.target_number]["Org"] = self.org
+                    self.planets_list[self.target_number]["Equ"] = self.equ
+                    self.planets_list[self.target_number]["Fig"] = self.fig
                     log.debug("Max Production is now {0}!".format(self.max_product))
 
-                    if self.fig['daily'] < self.max_product:
+                    if self.fig["daily"] < self.max_product:
                         # Oh nose, our change actually made things worse... let's fix that and try a different way
-                        if self.trying == 'Ore2Org':
-                            self.trying = 'Org2Ore'
-                        elif self.trying == 'Ore2Equ':
-                            self.trying = 'Equ2Ore'
-                        elif self.trying == 'Org2Equ':
-                            self.trying = 'Equ2Org'
+                        if self.trying == "Ore2Org":
+                            self.trying = "Org2Ore"
+                        elif self.trying == "Ore2Equ":
+                            self.trying = "Equ2Ore"
+                        elif self.trying == "Org2Equ":
+                            self.trying = "Equ2Org"
                         self.state = 6
 
-                    if self.ore['pop'] < 1 or self.org['pop'] < 1 or self.equ['pop'] < 1:
-                        self.send2game('Q')
-                        self.send2player(self.nl + Boxes.alert('Peak Fighter Production: {0}'.format(self.fig['daily'])))
+                    if (
+                        self.ore["pop"] < 1
+                        or self.org["pop"] < 1
+                        or self.equ["pop"] < 1
+                    ):
+                        self.send2game("Q")
+                        self.send2player(
+                            self.nl
+                            + Boxes.alert(
+                                "Peak Fighter Production: {0}".format(self.fig["daily"])
+                            )
+                        )
                         self.deactivate(True)
-        
 
 
 class ProxyMenu(object):
@@ -4455,15 +4508,15 @@ class ProxyMenu(object):
             d.addCallback(self.deactivate_scripts_menu)
             d.addErrback(self.deactivate_scripts_menu)
             return
-        elif key == '%':
+        elif key == "%":
             self.queue_game.put(self.c + key + self.r + self.nl)
             maxfigs = MaxFighterMake(self.game)
             d = maxfigs.whenDone()
             d.addCallback(self.deactivate_scripts_menu)
             d.addErrback(self.deactivate_scripts_menu)
             return
-        elif key == 'X':
-            self.queue_game.put(self.c + key + self.r + self.nl)            
+        elif key == "X":
+            self.queue_game.put(self.c + key + self.r + self.nl)
             self.deactivate_scripts_menu()
             return
         else: