private ArrayList<Move> possibleMovePosition(Color opposite, State temp_result) {

    ArrayList<Move> temp_position = new ArrayList<Move>();
    // for each square find piece
    for (int i = 0; i <= 7; i++) {
      for (int j = 0; j <= 7; j++) {
        Piece piece_check = temp_result.getPiece(new Position(i, j));
        if (piece_check != null) {
          if (piece_check.getColor().equals(opposite)) {
            PieceKind pk = piece_check.getKind();
            if (pk.equals(PAWN)) {
              addPossiPawnMove(opposite, new Position(i, j), temp_result, temp_position);
            }
            if (pk.equals(KNIGHT)) {
              addPossiKnightMove(opposite, new Position(i, j), temp_result, temp_position);
            }
            if (pk.equals(QUEEN)) {
              addPossiQueenMove(opposite, new Position(i, j), temp_result, temp_position);
            }
            if (pk.equals(ROOK)) {
              addPossiRookMove(opposite, new Position(i, j), temp_result, temp_position);
            }
            if (pk.equals(BISHOP)) {
              addPossiBishopMove(opposite, new Position(i, j), temp_result, temp_position);
            }
            if (pk.equals(KING)) {
              addPossiKingMove(opposite, new Position(i, j), temp_result, temp_position);
            }
          }
        }
      }
    }
    return temp_position;
  }
 @Override
 public Set<Position> getPossibleStartPositions(State state) {
   Color color = state.getTurn();
   Set<Position> result = new HashSet<Position>();
   if (state.getGameResult() != null) return result;
   for (int i = 0; i <= 7; i++) {
     for (int j = 0; j <= 7; j++) {
       Piece piece = state.getPiece(i, j);
       if ((piece != null) && (piece.getColor().equals(color))) {
         PieceKind pk = piece.getKind();
         if (pk.equals(PAWN)) {
           ArrayList<Move> temp = new ArrayList<Move>();
           addPossiPawnMove(color, new Position(i, j), state, temp);
           if (temp.size() > 0) result.add(new Position(i, j));
         }
         if (pk.equals(KNIGHT)) {
           ArrayList<Move> temp = new ArrayList<Move>();
           addPossiKnightMove(color, new Position(i, j), state, temp);
           if (temp.size() > 0) result.add(new Position(i, j));
         }
         if (pk.equals(QUEEN)) {
           ArrayList<Move> temp = new ArrayList<Move>();
           addPossiQueenMove(color, new Position(i, j), state, temp);
           if (temp.size() > 0) result.add(new Position(i, j));
         }
         if (pk.equals(ROOK)) {
           ArrayList<Move> temp = new ArrayList<Move>();
           addPossiRookMove(color, new Position(i, j), state, temp);
           if (temp.size() > 0) result.add(new Position(i, j));
         }
         if (pk.equals(BISHOP)) {
           ArrayList<Move> temp = new ArrayList<Move>();
           addPossiBishopMove(color, new Position(i, j), state, temp);
           if (temp.size() > 0) result.add(new Position(i, j));
         }
         if (pk.equals(KING)) {
           ArrayList<Move> temp = new ArrayList<Move>();
           addPossiKingMove(color, new Position(i, j), state, temp);
           if (temp.size() > 0) result.add(new Position(i, j));
         }
       }
     }
   }
   return result;
 }