Package edu.wisc.game.sql
Class Pairing
java.lang.Object
edu.wisc.game.sql.Pairing
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A player's current state in the pairing system. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
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.static void
Called on /newPlayer (from PlayerResponse()), to check if the new (or restored) player needs to be paired.static int
whoWillStartEpisode
(PlayerInfo p, int seriesNo, int epiNo) static int
whoWillStartSeries
(PlayerInfo p, int seriesNo) Which player starts the specified series?
-
Constructor Details
-
Pairing
public Pairing()
-
-
Method Details
-
newPlayerRegistration
Called on /newPlayer (from PlayerResponse()), to check if the new (or restored) player needs to be paired. -
ensurePairingNow
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
Which player starts the specified series? -
whoWillStartEpisode
- Parameters:
epiNo
- episode number within the series (0-based)
-