|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DotsModelInterface
Interface to Dots game model.
Nested Class Summary | |
---|---|
static class |
DotsModelInterface.TeamColour
The possible team colours. |
Field Summary | |
---|---|
static int |
defaultCols
Default number of columns on board. |
static int |
defaultRows
Default number of rows on board. |
Method Summary | |
---|---|
boolean |
addHorizontalSegment(int r,
int c)
Place a horizontal segment on the board. |
boolean |
addVerticalSegment(int r,
int c)
Place a vertical segment on the board. |
boolean |
canPlayContinue()
Check if game is over. |
int |
getCols()
|
DotsModelInterface.TeamColour |
getCurrentTurn()
Get the player colour who's turn it is now. |
DotsModelInterface.TeamColour |
getHorizontalSegmentColour(int r,
int c)
Get the colour of the horizontal segment. |
int |
getRows()
|
int |
getScore(DotsModelInterface.TeamColour t)
Get the current score for a player. |
DotsModelInterface.TeamColour |
getVerticalSegmentColour(int r,
int c)
Get the colour of the vertical segment. |
void |
reset()
Reset game to initial state. |
void |
setObserver(Observer o)
Set the observer for this model. |
void |
setSize(int rows,
int cols)
Set size of the game board. |
Field Detail |
---|
static final int defaultRows
static final int defaultCols
Method Detail |
---|
void setSize(int rows, int cols)
rows
- number of rows of dotscols
- number of columns of dotsvoid reset()
void setObserver(Observer o)
o
- Observer that should be notified via o.refresh()
with any change to model.boolean addHorizontalSegment(int r, int c)
r
- row to add in (0 = top)c
- column to add to right of (0 = leftmost)
boolean addVerticalSegment(int r, int c)
r
- row to add below (0 = top)c
- column to add in (0 = leftmost)
int getRows()
int getCols()
DotsModelInterface.TeamColour getHorizontalSegmentColour(int r, int c)
r
- row containing the segment.c
- column to left of segment.
DotsModelInterface.TeamColour getVerticalSegmentColour(int r, int c)
r
- row above the segment.c
- column containing the segment.
int getScore(DotsModelInterface.TeamColour t)
t
- player colour to get score for (White or BLACK)
DotsModelInterface.TeamColour getCurrentTurn()
boolean canPlayContinue()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |