package com.skraylabs.poker.model;

/**
 * The state of a Texas Hold 'Em Poker game.
 */
public class GameState {

  static final int MAX_PLAYERS = 10;

  /**
   * The "board". Community cards.
   */
  private Board board;

  /**
   * Pocket cards. Player cards. There is a maximum of 10 players.
   */
  private Pocket[] pockets = new Pocket[MAX_PLAYERS];

  /**
   * Default constructor.
   */
  GameState() {
  }

  /**
   * Accessor: get a copy of the board cards.
   *
   * @return community cards
   */
  public Board getBoard() {
    Board result = null;
    if (this.board != null) {
      result = new Board(this.board);
    }
    return result;
  }

  /**
   * Modifier: set the board cards.
   *
   * @param board community cards to set
   */
  void setBoard(Board board) {
    this.board = board;
  }

  /**
   * Accessor: get pocket cards.
   *
   * @return player cards
   */
  public Pocket[] getPockets() {
    return pockets;
  }

  /**
   * Modifier: set Pocket cards for a specified player.
   *
   * @param playerIndex a value in range [0, 9]. Specify player for which to assign pocket cards.
   * @param pocket Pocket value to assign.
   */
  void setPocketForPlayer(int playerIndex, Pocket pocket) {
    if (playerIndex < 0 || MAX_PLAYERS <= playerIndex) {
      throw new IllegalArgumentException(
          String.format("Unexpected value [%d] for 'playerIndex'. Must be in range [0, %d]",
              playerIndex, MAX_PLAYERS - 1));
    }
    pockets[playerIndex] = pocket;
  }
}

@@ -832,16 +832,30 @@
 or: get 
+copies of the 
 pocket c
@@ -852,32 +852,32 @@
 e pocket cards.%0A
-
    *%0A   * @retur
@@ -938,22 +938,212 @@
     
-return pockets
+Pocket%5B%5D result = new Pocket%5BMAX_PLAYERS%5D;%0A    for (int i = 0; i %3C MAX_PLAYERS; ++i) %7B%0A      if (this.pockets%5Bi%5D != null) %7B%0A        result%5Bi%5D = new Pocket(this.pockets%5Bi%5D);%0A      %7D%0A    %7D%0A    return result
 ;%0A  

make getPockets() “read only”.