Using processing and recursion, I’m trying to draw a similar shape to this:

But I feel like I’m losing my mind trying every possible way to draw the shape. This is closest I’ve gotten:
Plus my code, any help would be appreciated. Thanks:
void setup(){
size(600,600);
}
void draw(){
background(255);
draws(300, 300, 50, 5);
}
void draws(int x, int y, int x2, int num){
stroke(0);
strokeWeight(2);
line (x, y, (x+x2), y); //right
line(x, y, x, y-50); //right up
line (x-x2, y, x-(x2*2), y); // left
line(x-x2, y, x-x2, y-50); //left up
line (x, y-50, x-x2, y-50); //top
if(num>0){
draws(x-x2, y-x2, x2/2, num-1);
}
}
I got it! Thanks for the help.
Here is the meat of it, everything else was fine:
line(x, y, x, y-x2); //right
line(x-x2, y, x-x2, y-x2); //left
if (num>0) {
}
if (num==0) { //If there are no more instances, draw the horzontal lines
}