|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectDriver
public class Driver
This class is a part of the main functionality of the checkers game. This class contains the main method to start the game, it creates all necessary classes as informaton is provided. Its functions include knowing whose turn it is, remembering multiple jumps, relaying end of game conditions and ending the game.
Constructor Summary | |
---|---|
Driver()
Constructor Create the driver, which in turn creates the rest of the system. |
Method Summary | |
---|---|
void |
createPlayer(int num,
int type,
java.lang.String name)
This method creates the correct players for a game. |
void |
declineDraw(Player player)
The offer for a draw has been made. |
void |
drawOffered(Player player)
This method is called if a draw has been offered |
void |
endGame(java.lang.String message)
This method ends the checkers game due to whatever reason neccessary ie. |
void |
endInDraw(Player player)
This method ends the game in a draw, alerting both players that the draw has taken place |
void |
endInQuit(Player player)
Ends the game as a result of a player quitting, notifying each player |
void |
endTurn(Player player,
int space)
This method is called after a move has been checked. |
Facade |
getFacade()
Return the facade the GUI will talk to. |
int |
getGameMode()
Return the integer representing the type of game |
Player |
getOppositePlayer()
Return the player whos turn it is not |
Notifier |
getTimerNotifier()
Return the notifier of the Timer |
void |
setGameMode(int newMode)
Select the type of game |
void |
setHost(java.net.URL host)
This method sets the host the player will play against in case of a game over a network. |
void |
setPlayerColor(int num,
java.awt.Color color)
Set the color for a player using the passed in value. |
void |
setPlayerName(int num,
java.lang.String name)
Set the name for the player using the passed in values. |
void |
setTimer(int time,
int warning)
This method creates the timer to be used, if one is desired to be used. |
void |
startGame()
This method will start the game play. |
boolean |
timerRunning()
Whether the current game uses a timer |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Driver()
Method Detail |
---|
public Facade getFacade()
public void endTurn(Player player, int space)
player
- The player whose turn it will now bespace
- The space on the board from which a multiple
jump has to be madepublic void endGame(java.lang.String message)
message
- the message to send to all players regarding the
reason for ending the gamepublic void createPlayer(int num, int type, java.lang.String name)
type
- the type of player to be created (0 - local, 1 - network)name
- the name of the playernum
- the player's numberpublic void setPlayerName(int num, java.lang.String name)
num
- The player's number (1 or 2)name
- The name to assign to the player.public void setPlayerColor(int num, java.awt.Color color)
num
- The player's number (1 or 2)color
- The color to assign to the player.public void endInDraw(Player player)
public void drawOffered(Player player)
the
- player who offered the drawpublic void declineDraw(Player player)
player
- The player declining the draw.public void endInQuit(Player player)
the
- player who quitpublic void setTimer(int time, int warning)
time
- : the number of seconds for each turnwarning
- : whether or not a player will be warned
that their turn is going to endpublic void startGame()
public void setHost(java.net.URL host)
host
- the host of the game to be playedpublic Player getOppositePlayer()
public boolean timerRunning()
public void setGameMode(int newMode)
mode
- the mode (0 local, 1 host, 2 client) of the gamepublic int getGameMode()
public Notifier getTimerNotifier()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |