Creating a gradient of extruding bricks

Parametric Brick (20.6 KB)

Hello! I have a script here of a parametric brick wall - I can’t figure out how to create a gradient condition where say the left side of the wall has less extruded bricks and the right side of the wall has more extruded bricks. The gradient could be horizontal or vertical. How could I incorporate this into the script? I would really appreciate some help, thank you!