gvprojects.igel.model
Interface IIgelGame

All Known Implementing Classes:
IgelGameKurmas

public interface IIgelGame

A game of Igel Argern

Author:
Zachary Kurmas

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

canPlaceHedgehog

boolean canPlaceHedgehog(int row)
returns true if the current player can place a hedgehog in row (applies to initial hedgehog placement only).

Parameters:
row - the desired row
Returns:
true if the current player can place a hedgehog in row, false otherwise.
Throws:
java.lang.IllegalArgumentException - if row is not valid.
IllegalMoveException - if the game isn't currently in the Phase.SETUP phase

placeHedgehog

void placeHedgehog(int row)
Make an initial placement of one of the current player's hedgehogs in row and increment the current player.

Parameters:
row - the row
Throws:
java.lang.IllegalArgumentException - if row is not valid.
IllegalMoveException - if the game isn't currently in the Phase.SETUP phase

getState

IGameState getState()
get a read-only view of the game's current state.

Returns:
a read-only view of the game's current state.

addGameEventListener

void addGameEventListener(IIgelGame.GameEventListener listener)
Add a IIgelGame.GameEventListener

Parameters:
listener - the MessageChangeListener to add

canSlideHedgehog

boolean canSlideHedgehog(int fromRow,
                         int fromColumn)
Return true if the current player can slide the hedgehog at [fromRow, fromColumn]

Parameters:
fromRow - the current row of the player's hedgehog.
fromColumn - the current column of the player's hedgehog.
Returns:
true if the current player can slide the hedgehog at [fromRow, fromColumn].
Throws:
java.lang.IllegalArgumentException - if row is not valid.
IllegalMoveException - if the game isn't currently in the Phase.SIDEWAYS phase

canSlideHedgehog

boolean canSlideHedgehog(int fromRow,
                         int fromColumn,
                         int toRow)
Return true if the current player can slide the hedgehog at [fromRow, fromColumn] to [toRow, fromColumn].

Parameters:
fromRow - the current row of the player's hedgehog.
fromColumn - the current column of the player's hedgehog.
toRow - the destination row
Returns:
true if the current player can slide the hedgehog at [fromRow, fromColumn] to [toRow, fromColumn]
Throws:
java.lang.IllegalArgumentException - if row is not valid.
IllegalMoveException - if the game isn't currently in the Phase.SIDEWAYS phase

slideHedgehog

void slideHedgehog(int fromRow,
                   int fromColumn,
                   int toRow)
Move the current player's hedgehog from row fromRow to toRow

Parameters:
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.
Throws:
IllegalMoveException - if the game isn't currently in the Phase.SIDEWAYS phase, or of the requested move is not allowed.

canMoveHedgehog

boolean canMoveHedgehog(int fromRow,
                        int fromColumn)
Return whether the the top hedgehog at [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]

Parameters:
fromRow - the row
fromColumn - the column
Returns:
true if the the top hedgehog at [fromRow, fromColumn] can be moved forward.
Throws:
IllegalMoveException - if the game isn't currently in the Phase.MOVE phase.
java.lang.IllegalArgumentException - if fromRow or fromColumn isn't valid.

canMoveHedgehog

boolean canMoveHedgehog(int fromRow,
                        int fromColumn,
                        int toColumn)
Return whether the the top hedgehog at [fromRow, fromColumn] can be moved to column toColumn.

Parameters:
fromRow - the row
fromColumn - the column
toColumn - the proposed new column
Returns:
true if the the top hedgehog at [fromRow, fromColumn] can be moved to column toColumn
Throws:
IllegalMoveException - if the game isn't currently in the Phase.MOVE phase.
java.lang.IllegalArgumentException - if fromRow or fromColumn isn't valid.

moveHedgehog

void moveHedgehog(int fromRow,
                  int fromColumn,
                  int toColumn)
Move the top hedgehog at [fromRow, fromColumn] to column toColumn.

Parameters:
fromRow - the row
fromColumn - the column
toColumn - the proposed new column
Throws:
IllegalMoveException - if the game isn't currently in the Phase.MOVE phase, or if the proposed move isn't legal.

passSidewaysMove

void passSidewaysMove()
Pass the current user's sideways move.

Throws:
IllegalMoveException - if the game isn't currently in the Phase.SIDEWAYS phase.

setNextRolls

void setNextRolls(java.lang.Integer i)
Set the value of the die rolls. If i is null, roll a random value. If i is not null, then the die should return i

Parameters:
i - fix the die roll at i, or roll normally if i is null