|
|||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
bluegammon.logic
package contains logic aspects of the backgammon game.
See:
Description
Interface Summary | |
BoardStateListener | Implementations of this interface can be registered in
the BoardState and will receive events when the state changes.
|
PlayerListener | Implementations of this class can be registered in
the Player and will receive events upon player actions. |
Class Summary | |
Board | Representing a game state and basic logic for modifying and querying. |
BoardMediator |
The BoardMediator class is active during a backgammon game. |
BoardState | Singleton class holding game logic and state of a game. |
GameRecord | A game record represents one or multiple games between an opponent, keeping track of scores and such. |
LocalPlayer | A local player has access to the actual device. |
Player | Abstract class for a player. |
Rand | Global random generator. |
RemotePlayer | Represents a player that is on the other side of a connection; a remote player does not have access to this device. |
Rules | Contains state of rules and logic of deciding valid moves. |
The bluegammon.logic
package contains logic aspects of the backgammon game.
The central class in this package is the BoardMediator
- this class
is active during game play and mediates between the BoardState
class and the
BoardCanvas
class in the bluegammon.gui
package.
The BoardMediator
is accessed statically since it itself do not
hold any state. The logic game state belongs to the BoardState
singleton. This class
is updated instantly upon changes, e.g. piece movements. The gui state belongs to the
BoardCanvas
singleton, and can have transient states - for example, when a
piece is moved, it is not registered on destination in the BoardCanvas
until
the movement animation has finished.
The BoardState
can be observed by a BoardStateListener
, which is reported
upon backgammon events, piece movements, change in turns, finish of game, etc. The
BoardMediator
implements this interface and starts appropriate animations or sets
the appropriate gui state in the BoardCanvas
on events. The BoardCanvas
in turn reports user interaction to a LocalPlayer
, which, depending on the
gui or board state, invokes actions on the BoardMediator
.
As for the actual backgammon logic, the classes Board
, BoardState
, and
Rules
comprises the representation of a backgammon board, manipulation of pieces,
Player
and turns, and special rules, respectively.
|
|||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |