@@ -2698,6 +2698,9 @@ def auto_auto_assign_seats(self):
26982698
26992699 def reorder_players (self , order : list [int ]) -> None :
27002700 """Reorders the players in the pod.
2701+ Passing range(len(self._players)) will result no change in the order.
2702+ Passing [0, 1, 2, 3] will result no change in the order.
2703+ Passing [3, 2, 1, 0] will reverse the order of the players.
27012704
27022705 Args:
27032706 order: A list of integers representing the new order of the players.
@@ -2712,13 +2715,19 @@ def reorder_players(self, order: list[int]) -> None:
27122715 self ._players [:] = np .take (self ._players , order )
27132716
27142717 def clear (self ):
2718+ """Clears the pod of all players.
2719+ This method is called by the round when the pod is removed.
2720+ """
27152721 players = [p for p in self .players ]
27162722 for p in players :
27172723 self .remove_player (p , cleanup = False )
27182724 # self.players.clear()
27192725
27202726 @property
27212727 def name (self ):
2728+ """Returns the name of the pod.
2729+ The name of the pod is "Pod {}".format(self.table).
2730+ """
27222731 return "Pod {}" .format (self .table )
27232732
27242733 @override
@@ -3171,11 +3180,9 @@ def create_pairings(self) -> None:
31713180 pod .auto_auto_assign_seats ()
31723181
31733182 self .sort_pods ()
3174- self .apply_table_preference ()
3175-
3176- def sort_pods (self ) -> None :
3177- """Sort pods by number of players and average rating."""
31783183
3184+ def sort_pods_by_power (self ) -> None :
3185+ """Sort pods by number of players and average rating to establish a power-level baseline."""
31793186 pods_sorted = sorted (
31803187 self .pods ,
31813188 key = lambda x : (
@@ -3186,15 +3193,17 @@ def sort_pods(self) -> None:
31863193 )
31873194 self ._pods [:] = [pod .uid for pod in pods_sorted ]
31883195
3189- def apply_table_preference (self ) -> bool :
3196+ def sort_pods (self ) -> bool :
31903197 """Try to apply table preferences for players. Pod index is table number.
31913198 Preserves the relative power-sorted order of non-locked pods.
31923199 Prioritizes maximizing the number of satisfied preferences.
31933200
31943201 Returns:
31953202 bool: True if table preferences were applied, False otherwise.
31963203 """
3197- pods = self .pods # Already sorted by power
3204+ self .sort_pods_by_power ()
3205+
3206+ pods = self .pods # Expect pods to be already sorted by power
31983207 n = len (pods )
31993208 if n == 0 :
32003209 return False
0 commit comments