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

Home > Logic
Switched On (Posted on 2009-04-21) Difficulty: 3 of 5
This is a simple combination lock keypad to provide certain employees differing vault access.

Mouse 'pressing' the buttons turns on the lights in the display.
"R" initialises the display to the download position.


Each button (1-12) will activate at least one light cell but it may illuminate more. Note also that, while two switches may engage an individual bulb and so light it, any more will extinguish it.

A switch is 'ON' when its indicator changes from [O] to [ I ].

Determine the number of levels of security, the button combinations and provide a rationale for all solutions when the display is fully lit with no bulb activated by multiple buttons, otherwise a combination is void.

[Consider each button and its light(s) as a unique event which are not shared by another event in the solutions].

Incidentally, every button will feature at least once in the solutions, and if all buttons are on then no bulbs are lit!

See The Solution Submitted by brianjn    
No Rating

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

Experiment (pressing each button twice, to turn its bulbs on and off) shows that the following buttons control the shown bulbs:

     button  bulbs
          1: 8
          2: 5
          3: 4,8
          4: 4,6,8
          5: 4,6,7
          6: 3
          7: 2,7
          8: 2,6
          9: 2,5
         10: 1,5,6
         11: 1,3
         12: 1,3,7

There are 337 sets of switches that will light all the bulbs, but only 5 of those light each bulb only singly rather than doubly.

Presumably it is the 5 sets that only singly light all the bulbs that serve as the levels of security.

The five sets that only singly turn on all the lights are:

1  5  9  11
2  3  8  12
2  4  7  11
3  6  7  10
4  9  12

BTW, there are three sets that would light all 8 bulbs doubly:

 1  2  3  5  8  9  11  12
 1  3  5  6  7  9  10  11
 3  4  6  7  9  10  12


DECLARE SUB addin (wh!)


DATA 8,5,48,468,467,3,27,26,25,156,13,137

DIM SHARED s$(12), incl(12), bulbs$, bct(8), sCt, solCt

FOR i = 1 TO 12: READ s$(i): NEXT

CLS

addin 1

PRINT sCt, solCt

SUB addin (wh)
 IF wh = 1 THEN st = 1:  ELSE st = incl(wh - 1) + 1
 FOR nxt = st TO 12
  incl(wh) = nxt
  bulbs$ = bulbs$ + s$(nxt)
  good = 1
  FOR i = 1 TO LEN(s$(nxt))
   bct(VAL(MID$(s$(nxt), i, 1))) = bct(VAL(MID$(s$(nxt), i, 1))) + 1
   IF bct(VAL(MID$(s$(nxt), i, 1))) > 2 THEN good = 0
  NEXT

  IF good THEN
    SELECT CASE LEN(bulbs$)
     CASE IS >= 8
       FOR i = 1 TO 8
        ch$ = MID$("12345678", i, 1)
        IF INSTR(bulbs$, ch$) = 0 THEN good = 0: EXIT FOR
       NEXT i
       IF good THEN
         col = 40 * (sCt \ 30) + 1: row = sCt MOD 30 + 1
         IF LEN(bulbs$) = 8 THEN
          PRINT "*"; : solCt = solCt + 1
         ELSE
          PRINT " ";
         END IF
         FOR i = 1 TO wh
           PRINT incl(i);
         NEXT
           PRINT TAB(30);

         FOR i = 1 TO 8
           IF bct(i) > 1 THEN PRINT i;
         NEXT
         PRINT
         sCt = sCt + 1
       ELSE
         addin wh + 1
       END IF
     CASE ELSE
       addin wh + 1
    END SELECT
  END IF

  FOR i = 1 TO LEN(s$(nxt))
   bct(VAL(MID$(s$(nxt), i, 1))) = bct(VAL(MID$(s$(nxt), i, 1))) - 1
  NEXT
  bulbs$ = LEFT$(bulbs$, LEN(bulbs$) - LEN(s$(nxt)))
 NEXT nxt
END SUB


 


  Posted by Charlie on 2009-04-21 17:42:53
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (11)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information