public String serialize() {
        String str = "";
        for (int i = 0; i < this.mapGrid.length; i++) {
            for (int j = 0; j < this.mapGrid[0].length; j++) {
                if (mapGrid[i][j].isPawnOn()) { // set the id if there is pawn on the cell

                    str = str + "-" + mapGrid[i][j].getPlayerPawnOn();
                } else { // otherwise no player is on the entity and send the entity
                    // if the entity is an exit and it's hidden then will need to send the hiding object
                    if (mapGrid[i][j].getType() == Entity.EXIT && this.isExitHidden) {
                        if (mapGrid[i][j].getIcon() == boxIcon) {
                            str = str + "-" + Entity.BOX;
                        } else {
                            str = str + "-" + Entity.PATH;
                        }
                    } else { // put a normal entity with no player on and no hiddent exit
                        str = str + "-" + String.valueOf(mapGrid[i][j].getType());
                    }


                }
            }
        }
        return str;
    }