java.lang.Object
nz.ac.vuw.ecs.swen225.gp6.domain.IntegrityCheck.CheckGame

public final class CheckGame extends Object

This class contains a set of static method to check the integrity of the game.

- before a ping: step is successfully completed (by comparing the previous maze and inv to next ones).

- after a ping: by looking at the new altered domain, and making sure certain rules are always followed.

This class should be UPDATED REGULARLY to keep up with any new futures the game will have.

  • Constructor Details

    • CheckGame

      public CheckGame()
  • Method Details

    • checkStateChange

      public static void checkStateChange(Domain preDomain, Domain afterDomain)
      Checks the integrity of the game after a ping, and the game state is transitioning a step forward. (so the domain have correctly transitioned from before ping state to after ping state)
      Parameters:
      preDomain - the pre-ping domain that will be changed by one step
      afterDomain - the post-ping domain that will be compared with the pre-ping one
      Throws:
      IllegalStateException - in its check methods, to inform if the game is in an invalid state, it must also include string telling which rule has been broken.
    • checkCurrentState

      public static void checkCurrentState(Domain domain)
      Checks the integrity of the maze and inventory of a given game.
      Parameters:
      domain - the game that the maze and inventory will be accessed of
      Throws:
      IllegalStateException - in its check methods, to inform if the game is in an invalid state, it must also include string telling which rule has been broken
    • getTile

      public static Tile getTile(Maze maze, TileType type)
      returns the first tile with given type in the maze.
      Parameters:
      maze - maze to check for tile
      type - type of tile to find
    • getAllTiles

      public static List<Tile> getAllTiles(Maze maze, TileType type)
      returns the list of all tiles with given type in the maze.
      Parameters:
      maze - maze to check for tiles
      type - type of tile to find