Commits

makestory committed b3ec607

fix tuple and list match bug

  • Participants
  • Parent commits 096960d

Comments (0)

Files changed (1)

File examples/makestory/kojiro.py

         goal = sorted(self.info['eggs'],key=lambda egg : self.distance(self.head,egg))[0]
         for direction,rank in self.choices.items():
             wanna = self.move(direction)
-            rank = rank + 40 if wanna in self.info['gems'] else rank
-            rank = rank - 20 if wanna in self.info['eggs'] else rank
+            rank = rank + 40 if list(wanna) in self.info['gems'] else rank
+            rank = rank - 20 if list(wanna) in self.info['eggs'] else rank
             rank = rank - 10 if self.distance(wanna,goal) < self.distance(self.head,goal) else rank
             rank = rank + 3**len(set(self.around(wanna)) & set([tuple(o) for o in obstacles]))
             rank = rank + 500 if list(wanna) in obstacles else rank