Module app

Class HotSeatPlayer<M extends Move<P>,P extends Piece>

java.lang.Object
app.utils.pieceplayer.PieceSocket<M,P>
app.utils.pieceplayer.HotSeatPlayer<M,P>
All Implemented Interfaces:
Spectator<M,P>

public class HotSeatPlayer<M extends Move<P>,P extends Piece> extends PieceSocket<M,P>
Creates and controls all game players at once allowing to connect pieces only once

NOTE: If there is a piece belonging to multiple players it will be connected only to one of them

  • Field Details

  • Constructor Details

    • HotSeatPlayer

      public HotSeatPlayer(GameView<M,P> game, GameSocket<M,P> socket)
      Create new hot seat player and connect it as a spectator
      Parameters:
      game - view of game that will be played
      socket - socket that handles interactions
  • Method Details

    • connectPieces

      public void connectPieces(Function<P,? extends InteractivePiece<M,P>> newPiece)
      Description copied from class: PieceSocket
      Connects underlying game pieces to supplied interactors.

      Implementation should call this method and add newly created piece to the map

      Overrides:
      connectPieces in class PieceSocket<M extends Move<P>,P extends Piece>
      Parameters:
      newPiece - constructor of InteractivePiece that takes P as argument
    • connectPiece

      protected void connectPiece(P piece)
      Description copied from class: PieceSocket
      Connect a single piece and add it to the map
      Specified by:
      connectPiece in class PieceSocket<M extends Move<P>,P extends Piece>