+class World(game_common.World):
+
+ def __init__(self):
+ super().__init__()
+ self.Thing = Thing # use local Thing class instead of game_common's
+ self.player_id = 0
+
+ def proceed_to_next_player_turn(self):
+ """Run game world turns until player can decide their next step.
+
+ Iterates through all non-player things, on each step
+ furthering them in their tasks (and letting them decide new
+ ones if they finish). The iteration order is: first all things
+ that come after the player in the world things list, then
+ (after incrementing the world turn) all that come before the
+ player; then the player's .proceed() is run, and if it does
+ not finish his task, the loop starts at the beginning. Once
+ the player's task is finished, the loop breaks.
+ """
+ while True:
+ player = self.get_player()
+ player_i = self.things.index(player)
+ for thing in self.things[player_i+1:]:
+ thing.proceed()
+ self.turn += 1
+ for thing in self.things[:player_i]:
+ thing.proceed()
+ player.proceed(is_AI=False)
+ if player.task is None:
+ break
+
+ def get_player(self):
+ return self.get_thing(self.player_id)
+
+