There are 16 buttons in a four by four array. Each button has a horizontal arrow, pointing left or right, and a vertical arrow, pointing up or down. Initially, all arrows point towards the center of the array. In the below diagram, U is up, D is down, R is right, and L is left.
DR DR DL DL
DR DR DL DL
UR UR UL UL
UR UR UL UL
When you press a button, all other buttons in the direction of its horizontal arrow flip their vertical arrows, while all other buttons in the direction of the vertical arrow flip their horizontal arrows. The following diagram is the result after pressing the button in the upper left corner.
DR UR UL UL
DL DR DL DL
UL UR UL UL
UL UR UL UL
Find the least number of button presses required to get to the position in which all arrows point away from the center of the array.
No where near knowing if this is minimal, but here is a solution that actually reaches the desired end:
calling the positions
a1 a2 a3 a4
b1 b2 b3 b4
c1 c2 c3 c4
d1 d2 d3 d4
here is the sequence (13 button pushes):
a2,b1,a3,c1,b2,c4,d3,b2,b3,b4,b3,c2,d2,c2
I have split it out into 3 stages with configurations:
a2, b1, a3, c1, b2
-> all in one same direction
ul ul ul ul
ul ul ul ul
ul ul ul ul
ul ul ul ul
c4, d3, (all but 3 in one corner done)
->
ul ul ur ur
ul ul ur ur
dl dl dr ul
dl dl ul ul
b3, b4, b3, c2, d2, c2 (fix those 3)
->
ul ul ur ur
ul ul ur ur
dl dl dr dr
dl dl dr dr
|
Posted by Joel
on 2006-11-17 13:13:32 |