|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IIgelGame
A game of Igel Argern
Nested Class Summary | |
---|---|
static interface |
IIgelGame.GameEventListener
Listens for game events |
Method Summary | |
---|---|
void |
addGameEventListener(IIgelGame.GameEventListener listener)
Add a IIgelGame.GameEventListener |
boolean |
canMoveHedgehog(int fromRow,
int fromColumn)
Return whether the the top hedgehog at [ fromRow ,
fromColumn ] can be moved forward. |
boolean |
canMoveHedgehog(int fromRow,
int fromColumn,
int toColumn)
Return whether the the top hedgehog at [ fromRow ,
fromColumn ] can be moved to column toColumn . |
boolean |
canPlaceHedgehog(int row)
returns true if the current player can place a hedgehog in row (applies to initial hedgehog
placement only). |
boolean |
canSlideHedgehog(int fromRow,
int fromColumn)
Return true if the current player can slide the hedgehog at [fromRow , fromColumn ] |
boolean |
canSlideHedgehog(int fromRow,
int fromColumn,
int toRow)
Return true if the current player can slide the hedgehog at [fromRow ,
fromColumn ] to [toRow , fromColumn ]. |
IGameState |
getState()
get a read-only view of the game's current state. |
void |
moveHedgehog(int fromRow,
int fromColumn,
int toColumn)
Move the top hedgehog at [ fromRow ,
fromColumn ] to column toColumn . |
void |
passSidewaysMove()
Pass the current user's sideways move. |
void |
placeHedgehog(int row)
Make an initial placement of one of the current player's hedgehogs in row and increment the current player. |
void |
setNextRolls(java.lang.Integer i)
Set the value of the die rolls. |
void |
slideHedgehog(int fromRow,
int fromColumn,
int toRow)
Move the current player's hedgehog from row fromRow to toRow |
Method Detail |
---|
boolean canPlaceHedgehog(int row)
true
if the current player can place a hedgehog in row
(applies to initial hedgehog
placement only).
row
- the desired row
true
if the current player can place a hedgehog in row
, false
otherwise.
java.lang.IllegalArgumentException
- if row
is not valid.
IllegalMoveException
- if the game isn't currently in the Phase.SETUP
phasevoid placeHedgehog(int row)
row
and increment the current player.
row
- the row
java.lang.IllegalArgumentException
- if row
is not valid.
IllegalMoveException
- if the game isn't currently in the Phase.SETUP
phaseIGameState getState()
void addGameEventListener(IIgelGame.GameEventListener listener)
IIgelGame.GameEventListener
listener
- the MessageChangeListener
to addboolean canSlideHedgehog(int fromRow, int fromColumn)
true
if the current player can slide the hedgehog at [fromRow
, fromColumn
]
fromRow
- the current row of the player's hedgehog.fromColumn
- the current column of the player's hedgehog.
true
if the current player can slide the hedgehog at [fromRow
, fromColumn
].
java.lang.IllegalArgumentException
- if row
is not valid.
IllegalMoveException
- if the game isn't currently in the Phase.SIDEWAYS
phaseboolean canSlideHedgehog(int fromRow, int fromColumn, int toRow)
true
if the current player can slide the hedgehog at [fromRow
,
fromColumn
] to [toRow
, fromColumn
].
fromRow
- the current row of the player's hedgehog.fromColumn
- the current column of the player's hedgehog.toRow
- the destination row
true
if the current player can slide the hedgehog at [fromRow
,
fromColumn
] to [toRow
, fromColumn
]
java.lang.IllegalArgumentException
- if row
is not valid.
IllegalMoveException
- if the game isn't currently in the Phase.SIDEWAYS
phasevoid slideHedgehog(int fromRow, int fromColumn, int toRow)
fromRow
to toRow
fromRow
- the current row of the player's hedgehog.fromColumn
- the current column of the player's hedgehog.toRow
- the destination row. @throws IllegalArgumentException if row
is not valid.
IllegalMoveException
- if the game isn't currently in the Phase.SIDEWAYS
phase,
or of the requested move is not allowed.boolean canMoveHedgehog(int fromRow, int fromColumn)
fromRow
,
fromColumn
] can be moved forward. Note, the implementation in IgelGameKurmas
checks only that
the hedgehog at [fromRow
,
fromColumn
] may be moved. It does not check whether the hedgehog may move into [fromRow
,
fromColumn
+ 1]
fromRow
- the rowfromColumn
- the column
true
if the the top hedgehog at [fromRow
,
fromColumn
] can be moved forward.
IllegalMoveException
- if the game isn't currently in the Phase.MOVE
phase.
java.lang.IllegalArgumentException
- if fromRow
or fromColumn
isn't valid.boolean canMoveHedgehog(int fromRow, int fromColumn, int toColumn)
fromRow
,
fromColumn
] can be moved to column toColumn
.
fromRow
- the rowfromColumn
- the columntoColumn
- the proposed new column
true
if the the top hedgehog at [fromRow
,
fromColumn
] can be moved to column toColumn
IllegalMoveException
- if the game isn't currently in the Phase.MOVE
phase.
java.lang.IllegalArgumentException
- if fromRow
or fromColumn
isn't valid.void moveHedgehog(int fromRow, int fromColumn, int toColumn)
fromRow
,
fromColumn
] to column toColumn
.
fromRow
- the rowfromColumn
- the columntoColumn
- the proposed new column
IllegalMoveException
- if the game isn't currently in the Phase.MOVE
phase,
or if the proposed move isn't legal.void passSidewaysMove()
IllegalMoveException
- if the game isn't currently in the Phase.SIDEWAYS
phase.void setNextRolls(java.lang.Integer i)
i
is null
, roll a random value. If i
is not null
, then the die should return i
i
- fix the die roll at i
, or roll normally if i
is null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |