source/server/GameServer.py
def delPlayer(self, player):
        """Safely remove a player from the turn order
        
        Checks for game over if no more players and quits server
        Moves turn forward if it was deleted players turn.
        """
        player_index = self.players.index(player)
        self.players.remove(player)
        # if Shared_Board then need to update visible_cards_now dictionary.
        if self.rules.Shared_Board:
            # rebuild visible_cards_now with entries with key[0] = player_index removed and keys on other entries adjusted.
            visible_cards_previous = self.visible_cards_now
            self.visible_cards_now = {}
            for old_key, card_group in visible_cards_previous.items():
                if old_key[0] > player_index:
                    new_key = (old_key[0]-1, old_key[1])
                    self.visible_cards_now[new_key] = card_group
                elif old_key[0] < player_index:
                    new_key = old_key
                    self.visible_cards_now[new_key] = card_group
                # else old_key == player_index and you drop it from dictionary of visible_cards
            for p in self.players:
                p.visible_cards = self.visible_cards_now
        self.Send_publicInfo()
        #Check for no more players
        if len(self.players) == 0:
            self.game_over = True
            return
        #Check if it was deleted players turn and if so, make sure next player can start
        if self.turn_index == player_index and self.in_round:
            self.turn_index = self.turn_index % len(self.players) 
            self.players[self.turn_index].Send({"action": "startTurn"})
        #Reset turn_index to insure that a player doesn't lose their turn:
        if self.turn_index > player_index and self.in_round:
            self.turn_index = self.turn_index - 1 % len(self.players)
Safely remove a player from the turn order
        
        Checks for game over if no more players and quits server
        Moves turn forward if it was deleted players turn.
        
Safely remove a player from the turn order
Checks for game over if no more players and quits server
Moves turn forward if it was deleted players turn.
Safely remove a player from the turn order Checks for game over if no more players and quits server Moves turn forward if it was deleted players turn .
def delPlayer(self, player):
        player_index = self.players.index(player)
        self.players.remove(player)
        if self.rules.Shared_Board:
            visible_cards_previous = self.visible_cards_now
            self.visible_cards_now = {}
            for old_key, card_group in visible_cards_previous.items():
                if old_key[0] > player_index:
                    new_key = (old_key[0]-1, old_key[1])
                    self.visible_cards_now[new_key] = card_group
                elif old_key[0] < player_index:
                    new_key = old_key
                    self.visible_cards_now[new_key] = card_group
            for p in self.players:
                p.visible_cards = self.visible_cards_now
        self.Send_publicInfo()
        if len(self.players) == 0:
            self.game_over = True
            return
        if self.turn_index == player_index and self.in_round:
            self.turn_index = self.turn_index % len(self.players) 
            self.players[self.turn_index].Send({"action": "startTurn"})
        if self.turn_index > player_index and self.in_round:
            self.turn_index = self.turn_index - 1 % len(self.players)
def delPlayer ( self , player ) : player_index = self . players . index ( player ) self . players . remove ( player ) if self . rules . Shared_Board : visible_cards_previous = self . visible_cards_now self . visible_cards_now = { } for old_key , card_group in visible_cards_previous . items ( ) : if old_key [ 0 ] > player_index : new_key = ( old_key [ 0 ] - 1 , old_key [ 1 ] ) self . visible_cards_now [ new_key ] = card_group elif old_key [ 0 ] < player_index : new_key = old_key self . visible_cards_now [ new_key ] = card_group for p in self . players : p . visible_cards = self . visible_cards_now self . Send_publicInfo ( ) if len ( self . players ) == 0 : self . game_over = True return if self . turn_index == player_index and self . in_round : self . turn_index = self . turn_index % len ( self . players ) self . players [ self . turn_index ] . Send ( { "action" : "startTurn" } ) if self . turn_index > player_index and self . in_round : self . turn_index = self . turn_index - 1 % len ( self . players )
Safely remove a player from the turn order
Checks for game over if no more players and quits server
Moves turn forward if it was deleted players turn.
Safely remove a player from the turn order Checks for game over if no more players and quits server Moves turn forward if it was deleted players turn .
"""Safely remove a player from the turn order
        
        Checks for game over if no more players and quits server
        Moves turn forward if it was deleted players turn.
        """ # if Shared_Board then need to update visible_cards_now dictionary. # rebuild visible_cards_now with entries with key[0] = player_index removed and keys on other entries adjusted. # else old_key == player_index and you drop it from dictionary of visible_cards #Check for no more players #Check if it was deleted players turn and if so, make sure next player can start #Reset turn_index to insure that a player doesn't lose their turn:
self
player