From: <dil...@us...> - 2014-03-24 15:55:00
|
Revision: 6994 http://sourceforge.net/p/freeorion/code/6994 Author: dilvish-fo Date: 2014-03-24 15:54:55 +0000 (Mon, 24 Mar 2014) Log Message: ----------- AI research priority adjustment and a revision to the standalone python charting script Modified Paths: -------------- trunk/FreeOrion/default/AI/AIDependencies.py trunk/FreeOrion/default/AI/PriorityAI.py trunk/FreeOrion/default/AI/charting/charts.py Modified: trunk/FreeOrion/default/AI/AIDependencies.py =================================================================== --- trunk/FreeOrion/default/AI/AIDependencies.py 2014-03-23 18:04:13 UTC (rev 6993) +++ trunk/FreeOrion/default/AI/AIDependencies.py 2014-03-24 15:54:55 UTC (rev 6994) @@ -19,5 +19,6 @@ supply_range_techs = ["CON_ORBITAL_CON", "CON_CONTGRAV_ARCH", "CON_GAL_INFRA"] sing_tech_name = "PRO_SINGULAR_GEN" +prod_auto_name = "PRO_SENTIENT_AUTOMATION" Modified: trunk/FreeOrion/default/AI/PriorityAI.py =================================================================== --- trunk/FreeOrion/default/AI/PriorityAI.py 2014-03-23 18:04:13 UTC (rev 6993) +++ trunk/FreeOrion/default/AI/PriorityAI.py 2014-03-24 15:54:55 UTC (rev 6994) @@ -15,6 +15,7 @@ import ProductionAI import ResearchAI from time import time +import AIDependencies allottedInvasionTargets=0 @@ -152,7 +153,11 @@ totalPP = empire.productionPoints totalRP = empire.resourceProduction(fo.resourceType.research) - industrySurge= (foAI.foAIstate.aggression > fo.aggression.cautious) and ( totalPP <(30*(foAI.foAIstate.aggression)) ) and (orbGenTech in researchQueueList[:3] or empire.getTechStatus(orbGenTech) == fo.techStatus.complete) + industrySurge = ((foAI.foAIstate.aggression > fo.aggression.cautious) and + ( totalPP <(30*(foAI.foAIstate.aggression)) ) and + (orbGenTech in researchQueueList[:3] or empire.getTechStatus(orbGenTech) == fo.techStatus.complete) and + ( not ( + (len(AIstate.popCtrIDs) >= 5 )))) # previously (empire.getTechStatus(AIDependencies.prod_auto_name) == fo.techStatus.complete) and # get current industry production & Target ownedPlanetIDs = PlanetUtilsAI.getOwnedPlanetsByEmpire(universe.planetIDs, empireID) planets = map(universe.getPlanet, ownedPlanetIDs) @@ -346,8 +351,8 @@ #invasionPriority = max( 10+ 200*max(0, troopShipsNeeded ) , int(0.1* totalVal) ) invasionPriority = multiplier * (30+ 150*max(0, troopShipsNeeded )) - if ColonisationAI.colony_status['colonies_under_attack'] ==[]: - if ColonisationAI.colony_status['colonies_under_threat'] ==[]: + if ColonisationAI.colony_status.get('colonies_under_attack', []) ==[]: + if ColonisationAI.colony_status.get('colonies_under_threat', []) ==[]: invasionPriority *= 2.0 else: invasionPriority *= 1.5 Modified: trunk/FreeOrion/default/AI/charting/charts.py =================================================================== --- trunk/FreeOrion/default/AI/charting/charts.py 2014-03-23 18:04:13 UTC (rev 6993) +++ trunk/FreeOrion/default/AI/charting/charts.py 2014-03-24 15:54:55 UTC (rev 6994) @@ -26,7 +26,7 @@ else: return '' -doPlotTypes = ["PP"]+ [ "RP"] #+[ "ShipCount"] +doPlotTypes = ["PP"]+ [ "RP"] + ["RP_Ratio"] #+[ "ShipCount"] def parseFile(fileName, AI =True): print "processing file ", fileName @@ -34,7 +34,7 @@ gotColors=False gotSpecies=False gotName=False - data={"PP":[], "RP":[], "ShipCount":[], "turnsP":[], "turnPP":[]} + data={"PP":[], "RP":[], "RP_Ratio":[], "ShipCount":[], "turnsP":[], "turnPP":[]} details={'color':{1, 1, 1, 1}, 'name':"", 'species':""} with open(fileName, 'r') as lf: while True: @@ -63,6 +63,7 @@ RPPP = parts[1].split('(')[-1].split('/') data['PP'].append( float( RPPP[1]) ) data['RP'].append( float( RPPP[0]) ) + data['RP_Ratio'].append( float( RPPP[0])/float( RPPP[1]) ) if "Empire Ship Count:" in line: data['ShipCount'].append( int(line.split("Empire Ship Count:")[1])) return data, details @@ -115,6 +116,8 @@ caption="Production" elif plotType=="RP": caption="Research" + elif plotType=="RP_Ratio": + caption="Res:Prod Ratio" else: caption="Ships" figure(figsize=(10, 6)) @@ -151,7 +154,8 @@ xlabel('Turn') ylabel(plotType) title(caption+' Progression') - ax.set_yscale('log',basey=10) + if ymax >= 100: + ax.set_yscale('log',basey=10) if playerName not in allData: print "\t\t\tcan't find playerData in allData\n" @@ -180,12 +184,13 @@ title(caption+' Progression ') x1,x2,y1,y2 = axis() newY2=y2 - for yi in range(1, 10): - if 1.05*ymax < yi*y2/10: - newY2= yi*y2/10 - break - print "y1: %.1f ; ymin: %.1f ; newY2/100: %.1f"%(y1, ymin, newY2/100) - y1 = max(y1, 4, ymin, newY2/100) + if plotType in ["PP", "RP", "ShipCount"]: + for yi in range(1, 10): + if 1.05*ymax < yi*y2/10: + newY2= yi*y2/10 + break + print "y1: %.1f ; ymin: %.1f ; newY2/100: %.1f"%(y1, ymin, newY2/100) + y1 = max(y1, 4, ymin, newY2/100) axis( (x1,x2,y1,newY2)) grid(b=True, which='major', color='0.25',linestyle='-') grid(b=True, which='minor', color='0.1', linestyle='--') |