|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface provides the methods for overall control of a Boggle Game.
For CSE143, the concrete Controller classes must be located in
boggle.controller.BoggleController.java
The constructor must take NO parameters.
The constructor must create the Model and View.
The class must have a main method which simply creates an instance of
the Controller. After that, once the View is in execution, things
should run on their own. There are no defined command-line arguments for main.
IMPORTANT NOTE #1! :
Many of the methods are simply "pass-throughs" to the Model. Don't keep
duplicate information in both modules. For example: what characters are
on the board; how many rows and columns there are, etc. all are part of
the Model, even though this Controller interface has methods which allow the Controller
to be queried for them. Before implementing any Controller methods, it
is recommended that you be thoroughly familiar with what is in the other
two modules to avoid duplication.
The necessary resource files (if any), like dictionary and boards,
are recommended to be located in the directory of the controller.
IMPORTANT NOTE #2 :
You must define these two public static fields to specify the author and a brief description.
as follows:
public static final String author = " ... ";
public static final String description = " ... ";
"authors" should identify the authors in some fashion, but pseudonyms or
nicknames are acceptable. "description" should give a brief description
of the module, especially if there are any unexpected or unique features
about it. The information in both fields may be visible to the general
public, indefinitely into the future, so do not place any information here
which you do not wish to be publicly available.
Method Summary | |
void |
addToDictionary(String[] words)
Add new words to dictionary without changing what was already there. |
boolean |
addToProposal(int row,
int col)
This method will add the letter specified by row and col to the proposal string. |
void |
endGame()
End the current running game. |
int |
getBoardCols()
Get the number of columns in the board. |
int |
getBoardRows()
get the number of rows in the board. |
long |
getGameTime()
Get the total time duration of a game in milliseconds. |
int |
getLetterInBoard(int row,
int col)
return the character at the position specified by row and col. |
long |
getMillisRemaining()
Get the remaining left in the current game. |
int |
getScore()
Get the score for the current game. |
String |
getStatus()
Return a message which this components wants to be visible to the user. |
List |
getWordsHistory()
Get the words history from the Model. |
boolean |
isNewProposal()
Determine if the current word proposal is empty or not, i.e., whether any letters have been added to it. |
boolean |
isRunning()
This method will tell if the game is ended or not. |
boolean |
loadDictionary(String fileID)
Load a dictionary from a resource (file). |
void |
newProposal()
The current word proposal will be cleared. |
boolean |
removeLetterFromProposal()
Remove the last character in the proposed word. |
void |
setGameTime(long gametime)
Set the time duration of one game. |
void |
startGame()
Start a new game, with a new internally generated board. |
void |
startGame(String fileID)
Start a new game, intializing the board from the file given. |
void |
startTimer()
Start the timer, if the timer is stopped (create a new timer and start it, if there wasn't already a timer) |
int |
submitProposal()
When the user submits the proposed word, this method will check if the word is valid or not. |
void |
terminateApplication()
Terminate the application. |
Method Detail |
public boolean addToProposal(int row, int col)
row
- the row from which the letter comes.col
- the column from which the letter comes.
public boolean removeLetterFromProposal()
public int submitProposal()
public void newProposal()
public boolean isNewProposal()
public int getBoardCols()
public int getBoardRows()
public int getLetterInBoard(int row, int col)
row
- an integer specifying the row in the boardcol
- an integer specifying the col in the board
public void setGameTime(long gametime)
gametime
- the long type integer to specify the duration in milliseconds.public long getGameTime()
public long getMillisRemaining()
public void startTimer()
public void startGame()
public void startGame(String fileID)
fileID
- the location of the board to use.public void endGame()
public boolean isRunning()
public int getScore()
public String getStatus()
public List getWordsHistory()
public boolean loadDictionary(String fileID)
fileID
- a string to specify the place to load the resource from.
public void addToDictionary(String[] words)
words
- an array of strings to store in the dictionarypublic void terminateApplication()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |