The programoutput array must be trying"closer to makebeing symmetrical" than the input.
In the case where the array is already symmetrical, it must still flip a 1 to a 0, breaking as little symmetry as possible - e.g for
1,0,1 1,0,1 1,0,1 In the above case, changing the top-left 1 to a 0 will break symmetry in both directions, whereas changing the middle-left 1 will only break symmetry one way.
The output must be in the same form as the input (reflectionalso that your program or function could take it in again).
What is symmetry?
I am talking about reflectional symmetry along both the horizontal and vertical axes).
Where the array has an even number of entries in a row/column, the axis is between the two central rows/columns;columns:
1,0,|,0,1 1,0,|,0,1 -,-,-,-,- 1,0,|,0,1 1,0,|,0,1 otherwise it's down the middle of the middle row/column (and the numbers in that row/column count on both sides). In other words, 1,0,1 is the same as 1,0,0,1 in terms of symmetry.
| 1,0,1 -1,0,1- 1,0,1 | Some Examples
The output must be in the same form as theEach pair of grids below is input (so that your program or function could take it in again).
Your program must perform the flip, even if the array is already perfectly symmetrical. In this caseoutput, it should try and make it as easy as possible forwhich then becomes the program to make it symmetrical again next timeinput, etc. iteratively:
Some Examples
1,0,0,1 1,0,0,1 1,0,0,1 1,0,0,1 1,0,0,10 0,0,0,0 10,0,0,0 0,0,1,0 .. 0,0,0,0 .. 0,0,0,0 .. 0,0,0,0 .. 0,0,0,0 .. 0,0,0,0 .. 0,0,0,0 1,0,0,1 1,0,0,1 0,0,0,1 0,0,0,0 0,0,0,0 0,0,0,0 0,0,0,0