com.threerings.puzzle.server

## Class PuzzleManager

- java.lang.Object
- - com.threerings.crowd.server.PlaceManager
  - - com.threerings.parlor.game.server.GameManager
    - - com.threerings.puzzle.server.PuzzleManager

All Implemented Interfaces:
  com.threerings.crowd.chat.server.SpeakHandler.SpeakerValidator, ParlorCodes, GameCodes, PlayManager, com.threerings.presents.data.InvocationCodes, com.threerings.presents.dobj.ChangeListener, com.threerings.presents.dobj.MessageListener, com.threerings.presents.server.InvocationProvider, PuzzleCodes, PuzzleGameProvider

    public abstract class PuzzleManager
    extends GameManager
    implements PuzzleCodes, PuzzleGameProvider

Extends the `GameManager` with facilities for puzzle games.

### Nested Class Summary

### Nested classes/interfaces inherited from class com.threerings.crowd.server.PlaceManager

`com.threerings.crowd.server.PlaceManager.DelegateOp, com.threerings.crowd.server.PlaceManager.MessageHandler`

### Field Summary

### Fields inherited from interface com.threerings.puzzle.data.PuzzleCodes

`DEBUG_PUZZLE, DEFAULT_DIFFICULTY, PUZZLE_MESSAGE_BUNDLE`

### Fields inherited from interface com.threerings.presents.data.InvocationCodes

`ACCESS_DENIED, E_ACCESS_DENIED, E_INTERNAL_ERROR, GLOBAL_GROUP, INTERNAL_ERROR`

### Fields inherited from interface com.threerings.parlor.data.ParlorCodes

`ALREADY_AT_TABLE, BANNED_FROM_TABLE, GAME_ALREADY_STARTED, INVALID_TABLE_POSITION, INVITATION_ACCEPTED, INVITATION_COUNTERED, INVITATION_REFUSED, INVITEE_NOT_ONLINE, MUST_BE_CREATOR, NO_SELF_BOOT, NO_SUCH_TABLE, NOT_AT_TABLE, PARLOR_GROUP, TABLE_POSITION_OCCUPIED`

### Fields inherited from interface com.threerings.parlor.game.data.GameCodes

`GAME_CHAT_TYPE, GAME_MESSAGE_BUNDLE, PLAYER_KNOCKED_OUT, WINNERS_AND_LOSERS`

### Constructor Summary

Constructors
Constructor and Description
`PuzzleManager()`

### Method Summary

All Methods Instance Methods Concrete Methods
`Board[]` `getBoards()` Returns the boards for all players.
`BoardSummary` `getBoardSummary(int pidx)` Returns the board summary for the given player index.
`boolean` `needsBoardSummaries()` Returns whether this puzzle cares to make use of per-player board summaries that are sent periodically to all users in the puzzle via `sendStatusUpdate()`.
`void` `updateBoardSummaries()` Applies updateBoardSummary on all the players' boards.
`void` `updateBoardSummary(int pidx)` Calls `BoardSummary.summarize()` on the given player's board summary to refresh the summary information in preparation for sending along to the client(s).
`void` `updateProgress(com.threerings.presents.data.ClientObject caller, int sessionId, int[] events)` Handles a `PuzzleGameService.updateProgress(int, int[])` request.
`void` `updateProgressSync(com.threerings.presents.data.ClientObject caller, int sessionId, int[] events, Board[] states)` Called when the puzzle manager receives a progress update.

### Methods inherited from class com.threerings.parlor.game.server.GameManager

`addPlayer, addPlayerAt, allPlayersReady, cancelGame, checkWritePermission, endGame, endPlayerGame, getGameConfig, getGameId, getMatchType, getPlayer, getPlayerCount, getPlayerDisplayName, getPlayerIndex, getPlayerName, getPlayerOid, getPlayerPersistentId, getPlayerPersistentId, getPlayerSlots, getPresentPlayerIndex, getSessionId, isActivePlayer, isAgent, isAI, isPlayer, occupantInRoom, playerIsReady, playerReady, removePlayer, replacePlayer, resetGame, setAI, shouldConcludeGame, startGame, systemMessage, systemMessage`

### Methods inherited from class com.threerings.crowd.server.PlaceManager

`addDelegate, applyToDelegates, applyToOccupants, bodyWillEnter, bodyWillLeave, checkPermissions, getConfig, getLocation, getPlaceObject, init, isValidSpeaker, messageReceived, ratifyBodyEntry, registerMessageHandler, shutdown, startup, toString, updateOccupantInfo, where`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### PuzzleManager

    public PuzzleManager()

### Method Detail

#### getBoards

    public Board[] getBoards()

Returns the boards for all players.

#### getBoardSummary

    public BoardSummary getBoardSummary(int pidx)

Returns the board summary for the given player index.

#### needsBoardSummaries

    public boolean needsBoardSummaries()

Returns whether this puzzle cares to make use of per-player board summaries that are sent periodically to all users in the puzzle via `sendStatusUpdate()`. The default implementation returns `false`.

#### updateBoardSummary

    public void updateBoardSummary(int pidx)

Calls `BoardSummary.summarize()` on the given player's board summary to refresh the summary information in preparation for sending along to the client(s).

Parameters:
  `pidx` - the player index of the player whose board is to be summarized.

#### updateBoardSummaries

    public void updateBoardSummaries()

Applies updateBoardSummary on all the players' boards. AI board summaries should be updated by the AI logic.

#### updateProgress

    public void updateProgress(com.threerings.presents.data.ClientObject caller,
                               int sessionId,
                               int[] events)

Description copied from interface: `PuzzleGameProvider`
Handles a `PuzzleGameService.updateProgress(int, int[])` request.

Specified by:
  `updateProgress` in interface `PuzzleGameProvider`

#### updateProgressSync

    public void updateProgressSync(com.threerings.presents.data.ClientObject caller,
                                   int sessionId,
                                   int[] events,
                                   Board[] states)

Called when the puzzle manager receives a progress update. It checks to make sure that the progress update is valid and the puzzle is still in play and then applies the updates via `applyProgressEvents(int, int[], com.threerings.puzzle.data.Board[])`.

Specified by:
  `updateProgressSync` in interface `PuzzleGameProvider`