Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

simplegame.objects
Class GameBoard  view GameBoard download GameBoard.java

java.lang.Object
  extended bymarauroa.game.Attributes
      extended bymarauroa.game.RPObject
          extended bysimplegame.objects.GameBoard
All Implemented Interfaces:
marauroa.net.Serializable, simplegame.SimpleGameDataModelIF

public class GameBoard
extends marauroa.game.RPObject
implements simplegame.SimpleGameDataModelIF


Nested Class Summary
 
Nested classes inherited from class marauroa.game.RPObject
marauroa.game.RPObject.ID, marauroa.game.RPObject.NoSlotFoundException, marauroa.game.RPObject.SlotAlreadyAddedException, marauroa.game.RPObject.SlotsIterator
 
Nested classes inherited from class marauroa.game.Attributes
marauroa.game.Attributes.AttributeNotFoundException
 
Nested classes inherited from class simplegame.SimpleGameDataModelIF
simplegame.SimpleGameDataModelIF.GameUpdateListener
 
Field Summary
static int TYPE_GAME_BOARD
           
 
Fields inherited from class marauroa.game.RPObject
INVALID_ID, objectType
 
Fields inherited from class marauroa.game.Attributes
 
Constructor Summary
GameBoard()
           
GameBoard(int size)
           
 
Method Summary
 void addGameUpdateListener(simplegame.SimpleGameDataModelIF.GameUpdateListener ul)
           
private  int checkColumns()
           
private  int checkDiagonals()
           
private  int checkRows()
           
 int checkWinCondition()
          checks if someone already has won.
 int getLastPlayerID()
          returns the character id of the player who made the last move
 int getRPCharacterAt(int row, int column)
           
 int getSize()
          returns the size of the board.
 int getWinnerID()
          returns the winner id previously set by checkWinCondition
 boolean hasFreeMoves()
           
 void setRPCharacterAt(int row, int column, int characterID)
          makes a move for character.
 java.lang.String toString()
          This method returns a String that represent the object
 
Methods inherited from class marauroa.game.RPObject
addSlot, getSlot, hasSlot, readObject, slotsIterator, writeObject
 
Methods inherited from class marauroa.game.Attributes
equals, get, has, put, put, remove
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_GAME_BOARD

public static final int TYPE_GAME_BOARD
See Also:
Constant Field Values
Constructor Detail

GameBoard

public GameBoard()

GameBoard

public GameBoard(int size)
Method Detail

getLastPlayerID

public int getLastPlayerID()
returns the character id of the player who made the last move


getWinnerID

public int getWinnerID()
returns the winner id previously set by checkWinCondition

Specified by:
getWinnerID in interface simplegame.SimpleGameDataModelIF

getSize

public int getSize()
returns the size of the board. currently should always return 3 :)

Specified by:
getSize in interface simplegame.SimpleGameDataModelIF

setRPCharacterAt

public void setRPCharacterAt(int row,
                             int column,
                             int characterID)
makes a move for character. sets the field with coordinates row,column assigned to the characterID does nothing if the field is already set.

Specified by:
setRPCharacterAt in interface simplegame.SimpleGameDataModelIF

getRPCharacterAt

public int getRPCharacterAt(int row,
                            int column)
Specified by:
getRPCharacterAt in interface simplegame.SimpleGameDataModelIF

addGameUpdateListener

public void addGameUpdateListener(simplegame.SimpleGameDataModelIF.GameUpdateListener ul)
Specified by:
addGameUpdateListener in interface simplegame.SimpleGameDataModelIF

checkWinCondition

public int checkWinCondition()
checks if someone already has won.


hasFreeMoves

public boolean hasFreeMoves()

checkDiagonals

private int checkDiagonals()

checkColumns

private int checkColumns()

checkRows

private int checkRows()

toString

public java.lang.String toString()
Description copied from class: marauroa.game.RPObject
This method returns a String that represent the object