Module app
Package app.core.game

Interface GameView<M extends Move<P>,P extends Piece>

All Known Subinterfaces:
Game<M,P>
All Known Implementing Classes:
Checkers, Chess, InteractiveGame, Minesweeper

public interface GameView<M extends Move<P>,P extends Piece>
Interface for retrieving game state

This is separate interface from the game because sometimes we just want to look at the game without modifying it and putting everything in Game would violate Interface Segregation Principle

  • Method Summary

    Modifier and Type
    Method
    Description
    Returns all pieces in the game
    getLegalMoves(int player)
    Returns list of moves available for the player
    getLegalMoves(int player, P piece)
    Returns list of moves with given piece available for the player
    getPieces(int player)
    Returns all pieces that belong to the player
    int
    Returns number of player this game requires
  • Method Details

    • getPieces

      List<P> getPieces(int player)
      Returns all pieces that belong to the player
    • getAllPieces

      List<P> getAllPieces()
      Returns all pieces in the game
    • getLegalMoves

      List<M> getLegalMoves(int player)
      Returns list of moves available for the player
    • getLegalMoves

      List<M> getLegalMoves(int player, P piece)
      Returns list of moves with given piece available for the player
    • getPlayerCount

      int getPlayerCount()
      Returns number of player this game requires