public void setWeight(int x1, int y1, int x2, int y2, int weight){
        if(y2>this.height-1 || y2<0 || x2>this.width-1 || x2<0 || Math.abs(x1-x2)>1 || Math.abs(y1-y2)>1){
            return;
        }
        this.graph.setWeight(this.grid.get(new Coordinate(x1,y1)), this.grid.get(new Coordinate(x2,y2)), weight);
    }