org.jscience.computing.game
Interface JGamePlay

All Known Implementing Classes:
JAwari, JBlackJack, JCheckers, JChess, JDefaultGame, JFourWins, JGomoku, JMuehle, JReversi, JSolitaire, JTilePuzzle, JWS

public interface JGamePlay

JGamePlay provides functionality that is used by the GUI based JGameFrame to display the game specific features. All a specific game needs to do in order to be used with the JGameFrame is to simply implement these simple functions. All the rest is then done by the JGameFrame. For the object that implements JGamePlay to work smoothly with JGameFrame, that object should also be serializable. If a given GamePlay has no special needs for displaying itself, it may suffice to simply use an instance of JDefaultGame to provide the wrapper that implements this interface. Note that a JGamePlay's container should not allow to directly perform a move on the embedded AutoPlay object; instead it should delegate the handling of a move to the GameGUI object that uses this JGamePlay.

See Also:
JGameFrame, GamePlay, GameGUI, JDefaultGame

Field Summary
static int gameFrameX
          horizontal offset for positioning the game board
static int gameFrameY
          vertical offset for positioning the game board
static int historyFrameX
          horizontal offset for positioning the history moves
static int historyFrameY
          vertical offset for positioning the history moves
static int legalMovesFrameX
          horizontal offset for positioning the legal moves
static int legalMovesFrameY
          vertical offset for positioning the legal moves
static java.lang.String prototypeCellValue
          used to size the legal, history and redo move list
static int redoFrameX
          horizontal offset for positioning the redo moves
static int redoFrameY
          vertical offset for positioning the redo moves
static int windowHeight
          height of the window
static int windowLocationX
          x-coorinate of the upper left window corner
static int windowLocationY
          y-coorinate of the upper left window corner
static int windowWidth
          width of the window
 
Method Summary
 AutoPlay getAutoPlay()
          AutoPlay() returns the underlying game - to allow the calling functions to perform operations on the game itself.
 java.awt.Container getContainer(GameGUI frame)
          getContainer() returns the GUI component used to display the game representation.
 java.lang.String getDefaultFileExtension()
          getDefaultFileExtension() defines the String used as a file type when saving files; it should correspond to getFileFlter.
 javax.swing.filechooser.FileFilter getFileFilter()
          getFileFilter() provides the option to filter for certain file types when saving or loading games.
 java.awt.Container getHelp()
          getHelp() is to return a component (such as JLabel, JTextArea, etc) that can be displayed if a user selects the game specific help menu from a JGameFrame.
 javax.swing.JMenu getMenu()
          getMenu() provides the option to display a game specific menu within the overall JMenuBar of the JGameFrame.
 JGamePlay getNewGame()
          getNewGame() will initialize a new game and return the JGamePlay wrapper associated with the new game.
 java.lang.String getStatusMessage()
          getStatusMessage () is used to display a game specific status message, giving some information about the running game.
 java.lang.String getTitle()
          getTitle() returns a string used in JGameFrame to be displayed in the title bar of the top JFrame.
 JGamePlay setGame(AutoPlay game)
          setGame(AbstractGameBoard board) returns a JGamePlay object that embedds the given AutoPlay game.
 

Field Detail

windowLocationX

static final int windowLocationX
x-coorinate of the upper left window corner

See Also:
Constant Field Values

windowLocationY

static final int windowLocationY
y-coorinate of the upper left window corner

See Also:
Constant Field Values

windowWidth

static final int windowWidth
width of the window

See Also:
Constant Field Values

windowHeight

static final int windowHeight
height of the window

See Also:
Constant Field Values

legalMovesFrameX

static final int legalMovesFrameX
horizontal offset for positioning the legal moves

See Also:
Constant Field Values

legalMovesFrameY

static final int legalMovesFrameY
vertical offset for positioning the legal moves

See Also:
Constant Field Values

historyFrameX

static final int historyFrameX
horizontal offset for positioning the history moves

See Also:
Constant Field Values

historyFrameY

static final int historyFrameY
vertical offset for positioning the history moves

See Also:
Constant Field Values

redoFrameX

static final int redoFrameX
horizontal offset for positioning the redo moves

See Also:
Constant Field Values

redoFrameY

static final int redoFrameY
vertical offset for positioning the redo moves

See Also:
Constant Field Values

gameFrameX

static final int gameFrameX
horizontal offset for positioning the game board

See Also:
Constant Field Values

gameFrameY

static final int gameFrameY
vertical offset for positioning the game board

See Also:
Constant Field Values

prototypeCellValue

static final java.lang.String prototypeCellValue
used to size the legal, history and redo move list

See Also:
Constant Field Values
Method Detail

getContainer

java.awt.Container getContainer(GameGUI frame)
getContainer() returns the GUI component used to display the game representation.

Parameters:
frame - the object to be used to alter the game status by using the interface
Returns:
DOCUMENT ME!

getAutoPlay

AutoPlay getAutoPlay()
AutoPlay() returns the underlying game - to allow the calling functions to perform operations on the game itself.

Returns:
DOCUMENT ME!

getFileFilter

javax.swing.filechooser.FileFilter getFileFilter()
getFileFilter() provides the option to filter for certain file types when saving or loading games.

Returns:
DOCUMENT ME!

getDefaultFileExtension

java.lang.String getDefaultFileExtension()
getDefaultFileExtension() defines the String used as a file type when saving files; it should correspond to getFileFlter. Example: if getDefaultFileExtension() returns "test" and the user doesn't enter a file extension for the game to save but simply "game1", then the file saved will be name "game1.test".

Returns:
DOCUMENT ME!

getMenu

javax.swing.JMenu getMenu()
getMenu() provides the option to display a game specific menu within the overall JMenuBar of the JGameFrame.

Returns:
DOCUMENT ME!

getNewGame

JGamePlay getNewGame()
getNewGame() will initialize a new game and return the JGamePlay wrapper associated with the new game.

Returns:
DOCUMENT ME!

setGame

JGamePlay setGame(AutoPlay game)
                  throws GameRuntimeException
setGame(AbstractGameBoard board) returns a JGamePlay object that embedds the given AutoPlay game. This function enables the JGameFrame to load a game and transform it into a JGamePlay in a game specific way. If the given board doesn't match the implementation of JGamePlay, an exception is thrown.

Parameters:
game - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
GameRuntimeException

getTitle

java.lang.String getTitle()
getTitle() returns a string used in JGameFrame to be displayed in the title bar of the top JFrame.

Returns:
DOCUMENT ME!

getStatusMessage

java.lang.String getStatusMessage()
getStatusMessage () is used to display a game specific status message, giving some information about the running game. JGameFrame uses the return value for display in the status toolbar after a move is carried out.

Returns:
DOCUMENT ME!

getHelp

java.awt.Container getHelp()
getHelp() is to return a component (such as JLabel, JTextArea, etc) that can be displayed if a user selects the game specific help menu from a JGameFrame. It is ok to return null, in which case the JGameFrame will display a message that no specific help is available.

Returns:
DOCUMENT ME!