private void createItemClickListener(BoardItem item, final Board tokenBoard) {
    item.addMouseListener(
        new MouseListener() {
          @Override
          public void mouseReleased(MouseEvent e) {
            if (!GameState.getInstance().isGameOver()) {
              if (currentHorseToken == null) {
                currentHorseToken =
                    (HorseToken)
                        tokenBoard.getHorseToken(((BoardItem) (e.getSource())).getPosition());

                optionsDialog.refresh(
                    "Seleccionado: "
                        + currentHorseToken.getPosition().getRow()
                        + ", "
                        + currentHorseToken.getPosition().getColumn());

              } else {
                if (currentHorseToken
                    == (HorseToken)
                        tokenBoard.getHorseToken(((BoardItem) (e.getSource())).getPosition())) {
                  optionsDialog.refresh("Elemento deseleccionado");
                  reset();
                } else {
                  if (currentHorseToken.getTokenColor()
                      == ((HorseToken)
                              tokenBoard.getHorseToken(((BoardItem) (e.getSource())).getPosition()))
                          .getTokenColor()) {

                    currentHorseToken =
                        (HorseToken)
                            tokenBoard.getHorseToken(((BoardItem) (e.getSource())).getPosition());

                    optionsDialog.refresh(
                        "Seleccionado: "
                            + currentHorseToken.getPosition().getRow()
                            + ", "
                            + currentHorseToken.getPosition().getColumn());
                  } else {
                    targetCell = (Position) ((BoardItem) (e.getSource())).getPosition();

                    if (MovementChecker.check(
                        boardDialog.getBoard(),
                        boardDialog.getPlayerToMove(),
                        boardDialog.getDimension(),
                        currentHorseToken,
                        currentHorseToken.getPosition(),
                        targetCell,
                        boardDialog.getBlackQueenPosition(),
                        boardDialog.getWhiteQueenPosition(),
                        true)) {

                      logViewer.refresh(
                          "Ficha "
                              + currentHorseToken.getTokenColor()
                              + " mueve de ["
                              + currentHorseToken.getPosition().getRow()
                              + ", "
                              + currentHorseToken.getPosition().getColumn()
                              + "]");
                      logViewer.refresh(
                          " a [" + targetCell.getRow() + ", " + targetCell.getColumn() + "]\n");
                      MovementMaker.moveToEat(
                          boardDialog,
                          currentHorseToken,
                          tokenBoard.getHorseToken(targetCell),
                          targetCell,
                          logViewer);
                      boardDialog.changePlayerToMove();
                      optionsDialog.togglePlayer();
                      /*agent = new Agent(tokenBoard, boardDialog, logViewer);
                      boardDialog.changePlayerToMove();*/
                    }
                    reset();
                  }
                }
              }
            }
          }

          @Override
          public void mousePressed(MouseEvent e) {}

          @Override
          public void mouseClicked(MouseEvent e) {}

          @Override
          public void mouseEntered(MouseEvent e) {}

          @Override
          public void mouseExited(MouseEvent e) {}
        });
  }
  private void createEmptyCellClickListener(BoardItem item, final Board tokenBoard) {
    item.addMouseListener(
        new MouseListener() {
          @Override
          public void mouseReleased(MouseEvent e) {
            if (!GameState.getInstance().isGameOver()) {
              // borrar esto luego
              targetCell = (Position) ((BoardItem) (e.getSource())).getPosition();
              optionsDialog.refresh(
                  "Seleccionado: " + targetCell.getRow() + ", " + targetCell.getColumn());
              targetCell = null;
              // borrar hasta aqui

              if ((currentHorseToken != null) && (targetCell == null)) {

                targetCell = (Position) ((BoardItem) (e.getSource())).getPosition();

                if (MovementChecker.check(
                    boardDialog.getBoard(),
                    boardDialog.getPlayerToMove(),
                    boardDialog.getDimension(),
                    currentHorseToken,
                    currentHorseToken.getPosition(),
                    targetCell,
                    boardDialog.getBlackQueenPosition(),
                    boardDialog.getWhiteQueenPosition(),
                    true)) {

                  logViewer.refresh(
                      "Ficha "
                          + currentHorseToken.getTokenColor()
                          + " mueve de ["
                          + currentHorseToken.getPosition().getRow()
                          + ", "
                          + currentHorseToken.getPosition().getColumn()
                          + "]");
                  MovementMaker.move(boardDialog, currentHorseToken, targetCell);
                  logViewer.refresh(
                      " a [" + targetCell.getRow() + ", " + targetCell.getColumn() + "]\n");
                  boardDialog.changePlayerToMove();
                  optionsDialog.togglePlayer();
                  // agent = new Agent(tokenBoard, boardDialog, logViewer);
                  // boardDialog.changePlayerToMove();
                }

                // MOVER ELEMENTO
                reset();
              }
            }
          }

          @Override
          public void mousePressed(MouseEvent e) {}

          @Override
          public void mouseClicked(MouseEvent e) {}

          @Override
          public void mouseEntered(MouseEvent e) {}

          @Override
          public void mouseExited(MouseEvent e) {}
        });
  }