C
B D
A E
o F
K G
J H
I
The diagram above represents a dial on a safe which has 12 points, one of them white (denoted by o). This white point, is to be turned to each letter in turn, but not in alphabetical order, to open the safe. The dial should be turned toward the letters as follows:
- A before D but after B.
- B before C but after H.
- H before F, F before G, G before I and I before J.
- H after K, K before F, F after D,
D before G, and G after E.
- E before D, C before E, E after B, C before G, and A after E.
What is the order of letters to which the white point should be turned in order to open the safe?
DECLARE SUB addOn ()
CLEAR , , 25000
DIM SHARED used(11), alpha AS STRING, h AS STRING
alpha = "abcdefghijk"
CLS
h = ""
addOn
SUB addOn
FOR i = 1 TO 11
IF used(i) = 0 THEN
l$ = MID$(alpha, i, 1)
IF INSTR(h, l$) = 0 THEN
good = 1
SELECT CASE l$
CASE "a"
IF INSTR(h, "b") = 0 OR INSTR(h, "d") > 0 THEN good = 0
IF INSTR(h, "e") = 0 THEN good = 0
CASE "b"
IF INSTR(h, "h") = 0 OR INSTR(h, "c") > 0 THEN good = 0
CASE "c"
IF INSTR(h, "e") > 0 OR INSTR(h, "g") > 0 THEN good = 0
CASE "d"
IF INSTR(h, "g") > 0 THEN good = 0
CASE "e"
IF INSTR(h, "d") > 0 OR INSTR(h, "b") = 0 THEN good = 0
CASE "f"
IF INSTR(h, "d") = 0 OR INSTR(h, "g") > 0 THEN good = 0
CASE "g"
IF INSTR(h, "e") = 0 OR INSTR(h, "i") > 0 THEN good = 0
CASE "h"
IF INSTR(h, "f") > 0 OR INSTR(h, "k") = 0 THEN good = 0
CASE "i"
IF INSTR(h, "j") > 0 THEN good = 0
END SELECT
IF good THEN
h = h + l$
IF LEN(h) = 11 THEN
PRINT h
ELSE
addOn
END IF
h = LEFT$(h, LEN(h) - 1)
END IF
END IF
END IF
NEXT
END SUB
finds the order as
khbceadfgij
|
Posted by Charlie
on 2013-09-09 17:29:58 |