Class Pairing


  • public class Pairing
    extends Object
    Auxiliary methods for two-player games, introduced in GS 7.*. In a two-player game, a player may be in one of the following states: Must wait for the first display to appear Can retrieve a ready display Can make a move Must wait for the partner to make a move
    • Constructor Detail

      • Pairing

        public Pairing()
    • Method Detail

      • newPlayerRegistration

        public static void newPlayerRegistration​(PlayerInfo p)
        Called on /newPlayer (from PlayerResponse()), to check if the new (or restored) player needs to be paired.
      • ensurePairingNow

        public static boolean ensurePairingNow​(PlayerInfo p)
        This is called at the beginning of each episode (on a /newEpisode API call), to ensure that if this is a two-player game, the player is paired, if at all possible.
        Returns:
        true if pairing is needed, but is not possible right now, and therefore p has to wait to start playing
      • whoWillStartSeries

        public static int whoWillStartSeries​(PlayerInfo p,
                                             int seriesNo)
        Which player starts the specified series?
      • whoWillStartEpisode

        public static int whoWillStartEpisode​(PlayerInfo p,
                                              int seriesNo,
                                              int epiNo)
        Parameters:
        epiNo - episode number within the series (0-based)