Wolfsheep improved #2
This commit is contained in:
parent
98d5c95973
commit
5e2981624c
1 changed files with 2 additions and 2 deletions
|
@ -32,12 +32,12 @@ class Simulator:
|
||||||
for obj in state.right:
|
for obj in state.right:
|
||||||
nextStates.append( Model(state.left | set([Model.Man, obj]) , state.right - set([Model.Man,obj]) ) )
|
nextStates.append( Model(state.left | set([Model.Man, obj]) , state.right - set([Model.Man,obj]) ) )
|
||||||
|
|
||||||
nextStates = list(filter(
|
nextStates = filter(
|
||||||
lambda s: not(
|
lambda s: not(
|
||||||
s in stack or
|
s in stack or
|
||||||
any([ any([ invalid_state <= m for invalid_state in Simulator.invalid_states ]) and Model.Man not in m for m in [s.left,s.right] ])
|
any([ any([ invalid_state <= m for invalid_state in Simulator.invalid_states ]) and Model.Man not in m for m in [s.left,s.right] ])
|
||||||
)
|
)
|
||||||
, nextStates)) #Remove invalid and previous states.
|
, nextStates) #Remove invalid and previous states.
|
||||||
|
|
||||||
for s in nextStates:
|
for s in nextStates:
|
||||||
m = self.simulate(s,stack)
|
m = self.simulate(s,stack)
|
||||||
|
|
Loading…
Reference in a new issue