Commits

Anonymous committed 3fb6e30

complete as_completed run. Inefficient.

Comments (0)

Files changed (1)

         enemy.new_experience += 1
 
 
-def preparemovement(me):
+def preparemovement(me, battlefield):
     """Gather the data needed for movement."""
     if me.wounds[1]:
-        return me
+        return
     if me.enemy is None or not me.enemy.pos in battlefield:
         findenemy(me)
     if me.enemy is None:
-        return me
+        return
     me.forwards = stepforward(me, me.enemy)
     me.sidewards = stepsideward(me, me.enemy)
     me.odd = oddstep(me)
     """a single round of battle"""
     # concurrent preparation
     # step-by-step action
-    for me in et.map(preparemovement, fighters):
-        if me.wounds[1]:
-            continue
-        if me.enemy is None:
+    for me in (f.result() for f in as_completed([et.submit(preparemovement, me, battlefield) for me in fighters])):
+        if not me:
             continue
         for step in (me.forwards, me.sidewards, me.odd):
             if step in battlefield: