Wolfsheep improved #2

This commit is contained in:
madmaurice 2015-04-29 07:03:53 +02:00
parent 98d5c95973
commit 5e2981624c

View file

@ -32,12 +32,12 @@ class Simulator:
for obj in state.right:
nextStates.append( Model(state.left | set([Model.Man, obj]) , state.right - set([Model.Man,obj]) ) )
nextStates = list(filter(
nextStates = filter(
lambda s: not(
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] ])
)
, nextStates)) #Remove invalid and previous states.
, nextStates) #Remove invalid and previous states.
for s in nextStates:
m = self.simulate(s,stack)