Permalink
Browse files

couple of changes for robot avoidance

  • Loading branch information...
1 parent d17fcb3 commit dc78ad53ce73b2be1641064277ad06ebd0f9cb74 @bahniks committed Apr 26, 2014
Showing with 23 additions and 16 deletions.
  1. +4 −1 Stuff/Modules/explorer.py
  2. +7 −4 Stuff/Modules/filestorage.py
  3. +5 −8 Stuff/Modules/graphs.py
  4. +6 −2 Stuff/Modules/ra.py
  5. +1 −1 Stuff/Modules/version.py
@@ -915,6 +915,7 @@ def _setParameterDisplays(self, timeReset):
self.entrancesVar.set("0")
self.selectedPVar.set("-")
+
def _changeButtonStatuses(self):
if not self.showTrackVar.get():
self.playBut.state(["!disabled"])
@@ -962,7 +963,9 @@ def graphPopUp(self, event):
parameters = {"CM": ("periodicity", "mobility", "immobility", "entrances", "shocks",
"bad points", "thigmotaxis"),
"MWM": ("mobility", "immobility", "bad points", "thigmotaxis", "passes"),
- "OF": ("mobility", "immobility", "bad points", "thigmotaxis")}
+ "OF": ("mobility", "immobility", "bad points", "thigmotaxis"),
+ "RA": ("mobility", "immobility", "entrances", "shocks", "bad points",
+ "thigmotaxis")}
parameters["CMSF"] = parameters["CM"]
for parameter in parameters[m.mode]:
@@ -441,12 +441,15 @@ def openRoomFile(self, arenafile):
if arenafile in self.fileStorage.pairedfiles:
roomfile = self.fileStorage.pairedfiles[arenafile]
else:
- if "Arena" in basename(arenafile):
+ if m.pairing[m.mode][0] in basename(arenafile):
splitName = os.path.split(arenafile)
- roomfile = os.path.join(splitName[0], splitName[1].replace("Arena", "Room"))
- elif "arena" in basename(arenafile):
+ roomfile = os.path.join(splitName[0], splitName[1].replace(m.pairing[m.mode][0],
+ m.pairing[m.mode][1]))
+ elif m.pairing[m.mode][0].lower() in basename(arenafile):
splitName = os.path.split(arenafile)
- roomfile = os.path.join(splitName[0], splitName[1].replace("arena", "room"))
+ roomfile = os.path.join(splitName[0],
+ splitName[1].replace(m.pairing[m.mode][0].lower(),
+ m.pairing[m.mode][1].lower()))
if roomfile:
os.startfile(roomfile)
else:
View
@@ -19,7 +19,7 @@
from tkinter import *
from tkinter import ttk
-from math import degrees, atan2, floor
+from math import degrees, atan2, floor, ceil
from optionget import optionGet
import mode as m
@@ -177,7 +177,8 @@ def distance(line):
return cm.radius - min([line[2] - x0, x1 - line[2], line[3] - y0, y1 - line[3]])
else:
def distance(line):
- return ((line[2] - cm.centerX)**2 + (line[3] - cm.centerY)**2)**0.5
+ x, y = line[cm.indices]
+ return ((x - cm.centerX)**2 + (y - cm.centerY)**2)**0.5
for content in cm.data[start:]:
if content[1] <= self.maxTime:
if distance(content) >= border:
@@ -341,13 +342,9 @@ def compute(self, cm, skip = 12, smooth = 2):
self.points.append((avgSpeed / (smoothCounter % smooth)))
# computing maximum speed depicted on y-axis
- maxSpeed = max(self.points)
- if round(maxSpeed, -1) <= maxSpeed:
- self.maxY = round(maxSpeed, -1) + 10
- else:
- self.maxY = round(maxSpeed, -1)
+ self.maxY = ceil(max(self.points) / 10) * 10
+
-
def CM_loaded(self, cm, initTime = 0, minTime = 0, maxTime = "max"):
"""creates graph when CM file is loaded
parameter initTime is the time of the player when the graph is initialized
View
@@ -96,12 +96,17 @@ def _addReinforcedSector(self, string, position):
self.sectorRadius = eval(string[position+1])
-
def _cacheRemoval(self):
if (self.nameA, self.nameR) in RA.cache:
RA.cache.pop((self.nameA, self.nameR))
+ def _returnSame(self, missing):
+ toDeleteRat = self._findSame(slice(7,9), missing)
+ addMissing = {row[0] - 1 for row in self.data if tuple(row[7:9]) in toDeleteRat}
+ return addMissing
+
+
def removeReflections(self, points = None, deleteSame = True, bothframes = True):
if points == None:
ps = self.findReflections(time = "max", startTime = 0, results = "indices")
@@ -113,7 +118,6 @@ def removeReflections(self, points = None, deleteSame = True, bothframes = True)
super().removeReflections(points = ps, deleteSame = deleteSame, bothframes = True)
-
def _removalCondition(self, row, i, before, reflection):
"""conditions in order of appearance:
large speed between the row and before row
View
@@ -21,7 +21,7 @@ def version():
return ['0', '4', '0']
def date():
- return "23 April 2014"
+ return "26 April 2014"
def copyleft():
return "2013, 2014"

0 comments on commit dc78ad5

Please sign in to comment.