All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Layers (Posted on 2009-07-30)

Each grid has a light yellow background when first displayed. As cells are selected colours cycle through red, yellow and blue (cyan).

The object is to determine the minimum cell selections to present a layer of red, then a layer of yellow and finally blue for each grid option offered (or at least be able to move from one layer to the next which is less restrictive).

Those acquainted with "Lights Switched" will be aware of the ease to meet the 3x3 and 4x4 requirements of that problem. For those configurations here the situation may not be quite as easy, but how do you proceed with the other configurations?

 See The Solution Submitted by brianjn Rating: 4.0000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution Comment 1 of 1

The grids below under each grid size, the number of presses to make on each position so that the table advances to the next layer. Of course this will need to be done three times to solve the major puzzle given, as you need to advance from light yellow to red, from red to yellow and from yellow to blue(cyan). If there are multiple ways to advance one layer, then of course you could repeat the same method, or if there are multiple methods for a given grid size, use a different one each time.

All methods are shown, not just the one with the least count of presses for a given grid size, and the grids are not sorted by count.  Each count is shown below its grid.  If a given position is pressed twice, it counts for 2 in the count.

There is no solution for the 8x8 grid.

`The minima are:`
`3   104   165   216   447   538   can't be done9   4510  76`

These are for one advance from layer to layer. Triple for the full process asked for.

` 3 0 2 0 2 2 2 0 2 0 10`
` 4 0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 0 4`
` 4 0 2 2 0 2 0 0 2 2 0 0 2 0 2 2 0 16`
` 4 1 0 1 2 0 2 1 1 1 1 2 0 2 1 0 1 16`
` 4 1 1 0 2 2 2 1 2 2 1 2 2 2 0 1 1 22`
` 5 0 0 0 2 2 1 1 2 0 0 2 0 1 0 2 1 0 1 1 2 1 2 1 0 2 24`
` 5 0 0 1 2 0 1 0 1 1 2 0 2 1 1 1 1 1 2 0 0 2 1 0 1 0 21`
` 5 0 0 2 2 1 1 2 0 2 1 1 1 1 2 0 1 2 0 2 1 0 0 2 2 1 27`
` 5 0 2 0 0 2 2 2 2 2 2 0 2 1 1 1 0 2 1 2 0 2 2 1 0 1 30`
` 5 0 2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` 10 1 0 2 2 0 0 2 2 0 1 0 1 0 0 2 2 0 0 1 0 2 0 1 0 0 0 0 1 0 2 2 0 0 0 2 2 0 0 0 2 0 2 0 2 0 0 2 0 2 0 0 2 0 2 0 0 2 0 2 0 2 0 0 0 2 2 0 0 0 2 2 0 1 0 0 0 0 1 0 2 0 1 0 0 2 2 0 0 1 0 1 0 2 2 0 0 2 2 0 1 76`

DECLARE SUB build (col!)
DECLARE SUB complete (row!)

CLEAR , , 25000

DIM SHARED n, good

OPEN "ltout3w.txt" FOR OUTPUT AS #2

FOR n = 3 TO 10
REDIM SHARED bd(n + 1, n + 1), mv(n, n)
build 1
'DO: LOOP UNTIL INKEY\$ > ""
NEXT n

SUB build (col)
FOR v = 0 TO 2
bd(1, col) = (bd(1, col) + v) MOD 3
bd(2, col) = (bd(2, col) + v) MOD 3
bd(1, col - 1) = (bd(1, col - 1) + v) MOD 3
bd(1, col + 1) = (bd(1, col + 1) + v) MOD 3
mv(1, col) = v

IF col < n THEN
build col + 1
ELSE
CALL complete(2)
END IF

IF v > 0 THEN
bd(1, col) = (bd(1, col) - v + 3) MOD 3
bd(2, col) = (bd(2, col) - v + 3) MOD 3
bd(1, col - 1) = (bd(1, col - 1) - v + 3) MOD 3
bd(1, col + 1) = (bd(1, col + 1) - v + 3) MOD 3
END IF
NEXT
END SUB

SUB complete (row)
good = 1
FOR col = 1 TO n
mv(row, col) = (4 - bd(row - 1, col)) MOD 3

bd(row - 1, col) = (bd(row - 1, col) + mv(row, col)) MOD 3
bd(row, col) = (bd(row, col) + mv(row, col)) MOD 3
bd(row + 1, col) = (bd(row + 1, col) + mv(row, col)) MOD 3
bd(row, col - 1) = (bd(row, col - 1) + mv(row, col)) MOD 3
bd(row, col + 1) = (bd(row, col + 1) + mv(row, col)) MOD 3
NEXT

IF row = n THEN
FOR c = 1 TO n
IF bd(row, c) <> 1 THEN good = 0: EXIT FOR
NEXT
IF good THEN
PRINT n: pct = 0
PRINT #2, n
FOR r = 1 TO n: FOR c = 1 TO n
PRINT mv(r, c);
PRINT #2, mv(r, c);
pct = pct + mv(r, c)
NEXT: PRINT : PRINT #2, : NEXT
PRINT pct: PRINT
PRINT #2, pct: PRINT #2,
'DO: LOOP UNTIL INKEY\$ > ""
END IF
ELSE
complete row + 1
END IF

FOR col = 1 TO n
bd(row - 1, col) = (bd(row - 1, col) - mv(row, col) + 3) MOD 3
bd(row, col) = (bd(row, col) - mv(row, col) + 3) MOD 3
bd(row + 1, col) = (bd(row + 1, col) - mv(row, col) + 3) MOD 3
bd(row, col - 1) = (bd(row, col - 1) - mv(row, col) + 3) MOD 3
bd(row, col + 1) = (bd(row, col + 1) - mv(row, col) + 3) MOD 3
NEXT

END SUB

Rotations and reflections were weeded out by a second program acting on this program's output.

 Posted by Charlie on 2009-07-30 22:26:14

 Search: Search body:
Forums (0)