28
31
self.passed_waiting = set()
29
32
#number of successful adds to passed-waiting list
32
36
def stateInPwList(self, state):
33
37
return state in self.passed_waiting
35
def addState(self, state):
38
#return state in self.wp
40
def getWP(self, state):
43
def setWP(self, state, w, p):
46
def addState(self, state, w, p):
36
47
"""Add a state to the passed-waiting list.
37
48
@returns: state if state was new, False if state was seen before"""
38
if not self.stateInPwList(state):
52
(w1, p1) = self.wp[state]
67
self.wp[state] = (w2, p2)
69
#If there are something unexplored and state is not already on pw list
70
#if w2 < p2 and not w1 < p1:
71
if w2 < p2: #Add if unexplored
72
self.waiting.append(state)
39
78
self.waiting.append(state)
40
79
self.passed_waiting.add(state)
80
self.wp[state] = (w, p)
45
84
def getWaitingState(self):
47
86
return self.waiting.pop()