Beginning programmer here (mostly engineer). I'm making trapezoids in layers. We begin with the small length layer, and end with the longest length layer.
I want my user to input in a desired maximum length, a desired minimum length, type of pattern (5 or 7 each) and number of layers to use.
Then the program spits out an output based on these inputs. Here is an example with 5 plies:
5 Layer Example:
15 layers = MRMRM/MRMRM/MRMRM/
For a desired minimum length of 3, and varying maximum lengths, my desired output string would be:
MAX LENGTH 3: 3[MRMRM/MRMRM/MRMRM/]
MAX LENGTH 4: 3[MRMRM/MRMR] 4[M/MRMRM/]
MAX LENGTH 5: 3[MRMR] 4[M/MRMR] 5[M/MRMRM/]
MAX LENGTH 6: 3[MRMR] 4[M/MRMR] 5[M/MR] 6[MRM/]
(Separating out the M/ layers first, now splitting the MRMR into 2-char strings)
MAX LENGTH 7: 3[MRMR] 4[M/MR] 5[MR] 6[M/MR] 7[MRM/]
MAX LENGTH 8: 3[MRMR] 4[M/MR] 5[MR] 6[M/MR] 7[MR] 8[M/]
MAX LENGTH 9: 3[MR] 4[MR] 5[M/MR] 6[MR] 7[M/MR] 8[MR] 9[M/]
(Now splitting M/ from the MR strings last):
MAX LENGTH 10: 3[MR] 4[MR] 5[M/MR] 6[MR] 7[M/] 8[MR] 9[MR] 10[M/]
MAX LENGTH 11: 3[MR] 4[MR] 5[M/] 6[MR] 7[MR] 8[M/] 9[MR] 10[MR] 11[M/]
From there, it's a simple matter of taking the middle point and changing the numbers evenly between back and in front of the midpoint, evenly adding to the numbers.
I can't think of a simple algorithm to do this splitting. Since it is slightly less material, if a split happens on an odd number (like the jump from 3-4, or 5-6), we have the split occur on the far side of the midpoint. I envision having to do two algorithms, one for the 5 layer case and one for the 7 layer case.
Thoughts?