|
@@ -1115,16 +1115,8 @@ class ScriptExplore(object):
|
|
|
elif line == "":
|
|
|
self.state += 1
|
|
|
elif self.state == 4:
|
|
|
- # Ok so we do our Holo-Scan now how can we parse this... hmm.
|
|
|
- # Or do we just do that and then do a move? Hmmm... (I think we get enough info to make a choice)
|
|
|
- # Perhaps what we will do is do a Holo-Scan just to "count" as us going into that sector
|
|
|
-
|
|
|
- # TEST
|
|
|
- #self.dense = [
|
|
|
- # {'sector': 2, 'density': 0, 'warps': 1, 'navhaz': 0, 'anom': False},
|
|
|
- # {'sector': 1, 'density': 0, 'warps': 1, 'navhaz': 0, 'anom': False},
|
|
|
- # {'sector': 3, 'density': 0, 'warps': 2, 'navhaz': 0, 'anom': False},
|
|
|
- #]
|
|
|
+ # Begin Processing our data we got from density scan and find highest warp count in what sectors
|
|
|
+ # Remove sectors with one warp
|
|
|
|
|
|
# Do we have a new place to go? (That is also worth going to)
|
|
|
if not self.dense: # Dense contains no new sectors, abort
|
|
@@ -1161,35 +1153,22 @@ class ScriptExplore(object):
|
|
|
|
|
|
if self.clear: # We have sector(s) we can move to!
|
|
|
log.msg("Clear Sectors: {0}".format(len(self.clear)))
|
|
|
- self.state += 1
|
|
|
+ # This was state 5 but why can't we reduce number of states? ( Yeah let's kick California and New York out of the US, oh wrong states :P )
|
|
|
+ # Sort to find greatest warp count
|
|
|
+ for c in self.clear:
|
|
|
+ for d in self.dense:
|
|
|
+ if d['sector'] == c:
|
|
|
+ if d['warps'] > self.highwarp:
|
|
|
+ self.highwarp = d['warps']
|
|
|
+ self.highsector = c
|
|
|
+ elif d['warps'] == self.highwarp:
|
|
|
+ if c > self.highsector:
|
|
|
+ self.highsector = c
|
|
|
+
|
|
|
+ if self.highwarp and self.highsector:
|
|
|
+ log.msg("Sector: {0:5d} Warps: {1}".format(self.highsector, self.highwarp))
|
|
|
+ self.state += 1
|
|
|
elif self.state == 5:
|
|
|
- # Ok so we now have a idea of howmany and what sectors are clear and have greater than 1 warps
|
|
|
- # Now to sort thru that to see which ones have the highest warps and if they have a port or not
|
|
|
- # Then randomly if needed pick from those to actually move too! \o/ And poof we will be ready to make it loop
|
|
|
-
|
|
|
- # TEST, Just to show that my code picks the highest sector number if multiple sectors have the same warp count!
|
|
|
- #self.clear = [1, 2, 3]
|
|
|
- #log.msg("Clear: {0} Dense: {1}".format(len(self.clear), len(self.dense)))
|
|
|
-
|
|
|
- # Sort to find greatest warp count
|
|
|
- for c in self.clear:
|
|
|
- for d in self.dense:
|
|
|
- if d['sector'] == c:
|
|
|
- if d['warps'] > self.highwarp:
|
|
|
- self.highwarp = d['warps']
|
|
|
- self.highsector = c
|
|
|
- elif d['warps'] == self.highwarp:
|
|
|
- if c > self.highsector:
|
|
|
- self.highsector = c
|
|
|
-
|
|
|
- # If we found the best sector to move to and with previous test of safety we will now move to that sector!
|
|
|
- if self.highwarp != 0 or self.highsector != 0:
|
|
|
- log.msg("Sector: {0:5d} Warps: {1}".format(self.highsector, self.highwarp))
|
|
|
- self.state += 1
|
|
|
- else:
|
|
|
- log.msg("Oh Nose! We didn't find any Sector with higher Warps than any of the others!")
|
|
|
- self.deactivate()
|
|
|
- elif self.state == 6:
|
|
|
# Add the dense scan of unknown sectors onto the stack of sectors, only save the ones we think are clear... for now.
|
|
|
for c in self.clear:
|
|
|
self.stacksector.add(c)
|
|
@@ -1208,6 +1187,7 @@ class ScriptExplore(object):
|
|
|
self.times -= 1
|
|
|
if self.times <= 0:
|
|
|
self.send2player("Completed {0}".format(self.maxtimes))
|
|
|
+ log.msg("Completed {0}".format(self.maxtimes))
|
|
|
self.deactivate()
|
|
|
|
|
|
|