|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--PrintSuperClass
|
+--MessageTemplate
|
+--Message
Used to by battleship simulator to send message to each player,
Each message can have upto four fields: message ID (Integer), name descriptive string name of message details (Integer) and Class Pointer - class pointer to additional information public class Messages - Methods: public String getName( ) returns message String name public int get( ) returns current message ID public int getDetails( ) returns details of current message public Object getClassPointer( ) returns current class object pointer public void setMessageName provides self documenting code public boolean isMessageName() returns true if message is set deprecated replaces with setMessageName private void setDetails( ) sets details of current message public boolean set( int mID ) sets message ID Note System has Three Modes of Play: Head to Head Combat Mode - Message Sent to makeMove IDHeadToHead get ready getDetails has games to be played IDPlaceShip class pointer has ship class to place ships on IDNewGame return first move, getDetails has games left During Play IDHit, IDMiss (return next move) IDWin, IDLost (wait for IDNewGame) IDSunk getDetails has ship index IDTooManyMoves exceeded allowable attempts, details has #moves Single User Test Mode - Message Sent to makeMove IDSingleUser just get ready IDNewGame, (return your first move) IDHit, IDMiss, (return you next move) IDSunk, (return next move) IDWin, IDTooManyMoves, - Next message will be IDNewGame Note on IDSunk and IDWin, your ship at Sea board will have the HITCHAR replaced with the upper case ship code, i.e., Destroyer is 'D' getDetails returns Ship code of sunk sunk on IDSUNK returns number of games to still to play on IDSingleUser, and IDNewGame Simulation Mode Multiple players each must play a 1000 games to finish, This is followed by 100games against a benchMark Player each player is given a actual performance rating int getDetails( ) auxiliary info: NewSeries GameTypePointer Simulation vs RoundRobin NewGame GameCount, ShipPointer Sunk type of ShipSunk SeriesOver GameOverResults-Pointer Object getClassPointer( ) returns class Pointer checkAuthenication( PlayerPtr ) returns true if message was sent from battleShip and you are the intended receiver
| Field Summary | |
static int |
IDHeadToHead
|
static int |
IDHeadToHeadDone
|
static int |
IDHit
|
static int |
IDLost
|
static int |
IDMiss
|
static int |
IDNewGame
|
static int |
IDPerformanceRating
|
static int |
IDPlaceShips
|
static int |
IDPlaceShipsFailed
|
static int |
IDSeriesRating
|
static int |
IDSingleUser
|
static int |
IDSingleUserDone
|
static int |
IDSunk
|
static int |
IDTooManyMoves
|
static int |
IDTournament
|
static int |
IDTournamentDone
|
static int |
IDUnknown
|
static int |
IDWin
|
static int |
IDYourOpponents
|
static int |
IDYourShipHit
|
static int |
IDYourShipNearHit
|
static int |
IDYourShipSunk
|
static int |
IDYourWorstBoard
|
| Fields inherited from class MessageTemplate |
classPtr, details, msgID |
| Constructor Summary | |
Message(int mid,
java.lang.Object cp,
Player p)
|
|
| Method Summary | |
boolean |
checkAuthenication(Player forMe)
prohibits any changes in player using checkAuthenication |
java.lang.String |
getName()
|
boolean |
isGameOver()
|
boolean |
isHeadToHead()
|
boolean |
isHeadToHeadDone()
|
boolean |
isHit()
|
boolean |
isLost()
|
boolean |
isMiss()
|
boolean |
isNewGame()
|
boolean |
isPlaceShips()
|
boolean |
isSingleUser()
|
boolean |
isSingleUserDone()
|
boolean |
isSunk()
|
boolean |
isTooManyMoves()
|
boolean |
isTournament()
|
boolean |
isTournamentDone()
|
boolean |
isWin()
|
boolean |
isYourShipHit()
|
boolean |
isYourShipNearHit()
|
boolean |
isYourShipSunk()
|
boolean |
set(int mID)
Deprecated. replaces with setMessageName |
void |
setHeadToHead(int ngames,
Player opp)
|
void |
setHeadToHeadDone()
at end of a head to head combat, IDHeadToHeadDone is sent to both players data from head to head combat is added to SeriesRating link list |
void |
setHit(int moves)
|
void |
setLost(int moves)
|
void |
setMiss(int moves)
|
void |
setNewGame(int ngames,
Player opp)
Used by battleship simulator to set the message IDNewGame, |
void |
setPerformanceRating()
Vital Statisitics Skill now has updated performance rating |
void |
setPlaceShips(Ships ships)
|
void |
setPlaceShipsFailed()
Player is given five attempts to place ships |
void |
setSeriesRating()
at End of HeadToHead tournament series, IDSeriesRating message is sent to each player |
void |
setSingleUser(int ngames)
|
void |
setSingleUserDone()
at end of singleUserTestMode, IDSingleUserDone is sent to player |
void |
setSunk(int shipID)
|
void |
setTooManyMoves(int moves,
Ships failed)
|
void |
setTournament(int ngames)
Start Tournament mode, |
void |
setTournamentDone()
at End of tournament mode, IDTournamentDone is sent to each player |
void |
setUnknown()
Used by battleship simulator to set an Unknown Message |
void |
setWin(int moves)
Used by battleship simulator to set the message IDWin, |
void |
setYourShipHit(int coordinate,
Ships atSea)
|
void |
setYourShipNearHit(int coordinate,
Ships atSea)
|
void |
setYourShipSunk(int shipID,
Ships atSea)
|
void |
setYourWorstBoard(int moves,
Ships failed)
|
java.lang.String |
toString()
|
| Methods inherited from class MessageTemplate |
checkAuthenication, copy, get, getClassPointer, getDetails, getRecipient, getSignature, print, println, setAuthenication, setClassPointer |
| Methods inherited from class PrintSuperClass |
print, print, print, println, println, println |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int IDUnknown
public static final int IDWin
public static final int IDLost
public static final int IDSunk
public static final int IDNewGame
public static final int IDHit
public static final int IDMiss
public static final int IDHeadToHead
public static final int IDTournament
public static final int IDSingleUser
public static final int IDPlaceShips
public static final int IDTooManyMoves
public static final int IDPlaceShipsFailed
public static final int IDYourShipSunk
public static final int IDYourShipHit
public static final int IDYourShipNearHit
public static final int IDYourWorstBoard
public static final int IDPerformanceRating
public static final int IDYourOpponents
public static final int IDSeriesRating
public static final int IDTournamentDone
public static final int IDSingleUserDone
public static final int IDHeadToHeadDone
| Constructor Detail |
public Message(int mid,
java.lang.Object cp,
Player p)
| Method Detail |
public void setUnknown()
public void setWin(int moves)
moves - is the number of game moves, details is set to movespublic void setLost(int moves)
public void setSunk(int shipID)
public void setNewGame(int ngames,
Player opp)
details - is set to the number of games left to be playerdopp - is set to your opponentpublic void setHit(int moves)
public void setMiss(int moves)
public void setHeadToHead(int ngames,
Player opp)
public void setTournament(int ngames)
playerList, - is set to head of link list or Playerspublic void setSingleUser(int ngames)
public void setPlaceShips(Ships ships)
ships - is pointer to ship-board you must place ships on
public void setTooManyMoves(int moves,
Ships failed)
moves - is set to number of moves in gamefailed - is set to ship image of board you failed onpublic void setPlaceShipsFailed()
public void setYourShipHit(int coordinate,
Ships atSea)
details - is set singleton coordinate of location just hitatSea - is the ship board you created, has updates
public void setYourShipSunk(int shipID,
Ships atSea)
details - is set to ID of ship just sunkatSea - is set to your current status of ships at Sea
public void setYourShipNearHit(int coordinate,
Ships atSea)
details - is set to singleton coordinate locaion of near hitatSea - is set to your current status of ships at Sea
Caveat not implemented
public void setYourWorstBoard(int moves,
Ships failed)
moves - is set to number of moves for your worst game in singleUserTestMode
classPointer Ships is set to a copy of this boardpublic void setPerformanceRating()
public void setSeriesRating()
public void setTournamentDone()
public void setHeadToHeadDone()
public void setSingleUserDone()
public boolean checkAuthenication(Player forMe)
public java.lang.String getName()
getName in class MessageTemplatepublic java.lang.String toString()
toString in class MessageTemplatepublic boolean isWin()
public boolean isLost()
public boolean isSunk()
public boolean isNewGame()
public boolean isHit()
public boolean isMiss()
public boolean isHeadToHead()
public boolean isTournament()
public boolean isSingleUser()
public boolean isPlaceShips()
public boolean isTooManyMoves()
public boolean isYourShipHit()
public boolean isYourShipSunk()
public boolean isYourShipNearHit()
public boolean isTournamentDone()
public boolean isSingleUserDone()
public boolean isHeadToHeadDone()
public boolean set(int mID)
public boolean isGameOver()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||