model
Class GameModel

java.lang.Object
  extended by model.GameModel
Direct Known Subclasses:
ClearCellGameModel

public abstract class GameModel
extends java.lang.Object

This class represents the logic of a game where a board is updated on each step of the game animation. The board can also be updated by selecting a board cell.

Author:
Dept of Computer Science, UMCP

Constructor Summary
GameModel(int maxRows, int maxCols)
          Defines a board with BoardCell.EMPTY cells.
 
Method Summary
 BoardCell getBoardCell(int rowIndex, int colIndex)
           
 int getMaxCols()
           
 int getMaxRows()
           
abstract  int getScore()
           
abstract  boolean isGameOver()
           
abstract  void nextAnimationStep()
          Advances the animation one step.
abstract  void processCell(int rowIndex, int colIndex)
          Adjust the board state according to the current board state and the selected cell.
 void setBoardCell(int rowIndex, int colIndex, BoardCell boardCell)
           
 java.lang.String toString()
          Provides a string representation of the board We have implemented this method for you.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GameModel

public GameModel(int maxRows,
                 int maxCols)
Defines a board with BoardCell.EMPTY cells.

Parameters:
maxRows -
maxCols -
Method Detail

getMaxRows

public int getMaxRows()

getMaxCols

public int getMaxCols()

setBoardCell

public void setBoardCell(int rowIndex,
                         int colIndex,
                         BoardCell boardCell)

getBoardCell

public BoardCell getBoardCell(int rowIndex,
                              int colIndex)

toString

public java.lang.String toString()
Provides a string representation of the board We have implemented this method for you.

Overrides:
toString in class java.lang.Object

isGameOver

public abstract boolean isGameOver()

getScore

public abstract int getScore()

nextAnimationStep

public abstract void nextAnimationStep()
Advances the animation one step.


processCell

public abstract void processCell(int rowIndex,
                                 int colIndex)
Adjust the board state according to the current board state and the selected cell.

Parameters:
rowIndex -
colIndex -


Web Accessibility