Given an input composed of:
- an image,
- an integer
- an other integer
your program, or function, or anything else that fits, must output the same image (i.e. same size and format) as the input, but that underwent the following process:
- divide the image into
- remove one of those rectangles, randomly,
- move a random number of contiguous rectangles from the line/column affected by point (2.) so the hole created is filled and another one is generated in this line/column. This number can be
0if the blank is in a corner or an edge.
- If you moved rectangles from the line in step (3.), you must move rectangles from the column the in the next repetition,
- if you moved rectangles left-to-right in a line-step, they must be moved right-to-left in the next line-step, same for top-to-bottom and bottom-to-top concerning columns,
- you may assume that
nwill be chosen so it divides the lengths of the sides of the picture.
A last point:
.gif showing the whole process are very welcomed.
I propose to use the following picture (which is
r=100 as a model, you can use any other picture (as long as it's relevant and complies with SE's rules, of course).
Note that standards loopholes policies apply.
This is code-golf, so the shorter submission wins !
Since an example was requested, here is one, made "by hand", with
Steps 1 and 2
Step 3 : line-wise, 2 rectangles to the left