示例#1
0
    def __init__(
            self,
            nplayers=2,
            onmove=0,
            systems=None,
            stash=None,
            alive=None,  # list of player statuses, None for not yet created
    ):
        self.nplayers = nplayers
        self.onmove = onmove

        if systems is None:
            systems = []
            alive = [None] * nplayers
        self.systems = systems

        if stash is None:
            stash = Stash(nplayers + 1)
            for sys in systems:
                for m in sys.markers:
                    stash.request(m)
                for s in sys.ships:
                    stash.request(s.piece)
        self.stash = stash

        if alive is None:
            # This assumes that players with no home have been eliminated
            alive = [False] * nplayers
            for sys in systems:
                if not sys.home is None:
                    alive[sys.home] = True

        self.alive = alive
        # This turn will be built one event as a time
        self.curTurn = Turn(self)