Yet another nightmare fix (with initial path selection)

This commit is contained in:
skizzerz 2015-10-30 22:55:52 -05:00
parent 106e7ed213
commit 6e647e86e9

View File

@ -821,21 +821,24 @@ class SleepyMode(GameMode):
directions = ["n", "e", "s", "w"] directions = ["n", "e", "s", "w"]
self.step = 0 self.step = 0
self.prev_direction = None self.prev_direction = None
for i in range(0, 3): opposite = {"n": "s", "e": "w", "s": "n", "w": "e"}
dir2 = directions[:] for i in range(3):
if self.prev_direction == "n": corrdir = directions[:]
dir2.remove("s") f1dir = directions[:]
elif self.prev_direction == "e": f2dir = directions[:]
dir2.remove("w") if i > 0:
elif self.prev_direction == "s": corrdir.remove(opposite[self.correct[i-1]])
dir2.remove("n") f1dir.remove(opposite[self.fake1[i-1]])
elif self.prev_direction == "w": f2dir.remove(opposite[self.fake2[i-1]])
dir2.remove("e") else:
self.correct[i] = random.choice(directions) coordir.remove("s")
self.fake1[i] = random.choice(directions) f1dir.remove("s")
self.fake2[i] = random.choice(directions) f2dir.remove("s")
self.prev_direction = "s" if self.correct[0] != "s" else "w" self.correct[i] = random.choice(corrdir)
self.start_direction = self.prev_direction self.fake1[i] = random.choice(f1dir)
self.fake2[i] = random.choice(f2dir)
self.prev_direction = "n"
self.start_direction = "n"
self.on_path = set() self.on_path = set()
self.nightmare_step(cli) self.nightmare_step(cli)