DECLARE FUNCTION goodVtx2$ (x$)
DECLARE FUNCTION isWord2! (w$)
DECLARE FUNCTION goodVtx! (x$)
DECLARE FUNCTION isWord! (w$)
DATA iyalyo, botesl, atyybs, rcrmfm, axfrrs, uolplu, ytssen
FOR i = 1 TO 7: READ disk$(i): NEXT
DIM SHARED l
OPEN "\words\words3.txt" FOR BINARY AS #2
l = LOF(2) / 3
CLS
FOR disk1 = 1 TO 7
IF used(disk1) = 0 THEN
used(disk1) = 1
FOR disk1o = 0 TO 5
disk1$ = RIGHT$(disk$(disk1), disk1o) + LEFT$(disk$(disk1), 6 - disk1o)
chk1$ = "ma" + MID$(disk1$, 1, 1)
chk2$ = "on" + MID$(disk1$, 2, 1)
IF goodVtx(chk1$) AND goodVtx(chk2$) THEN
FOR disk2 = 1 TO 7
IF used(disk2) = 0 THEN
used(disk2) = 1
FOR disk2o = 0 TO 5
disk2$ = RIGHT$(disk$(disk2), disk2o) + LEFT$(disk$(disk2), 6 - disk2o)
chk5$ = "t" + MID$(disk2$, 1, 1) + MID$(disk1$, 3, 1)
chk6$ = "pt" + MID$(disk2$, 2, 1)
chk10$ = "lo" + MID$(disk2$, 3, 1)
IF goodVtx(chk5$) AND goodVtx(chk6$) AND goodVtx(chk10$) THEN
FOR disk3 = 1 TO 7
IF used(disk3) = 0 THEN
used(disk3) = 1
FOR disk3o = 0 TO 5
disk3$ = RIGHT$(disk$(disk3), disk3o) + LEFT$(disk$(disk3), 6 - disk3o)
chk14$ = "e" + MID$(disk3$, 2, 1) + MID$(disk2$, 4, 1)
chk18$ = "at" + MID$(disk3$, 3, 1)
chk22$ = "im" + MID$(disk3$, 4, 1)
IF goodVtx(chk14$) AND goodVtx(chk18$) AND goodVtx(chk22$) THEN
FOR disk4 = 1 TO 7
IF used(disk4) = 0 THEN
used(disk4) = 1
FOR disk4o = 0 TO 5
disk4$ = RIGHT$(disk$(disk4), disk4o) + LEFT$(disk$(disk4), 6 - disk4o)
chk21$ = "f" + MID$(disk4$, 3, 1) + MID$(disk3$, 5, 1)
chk24$ = "it" + MID$(disk4$, 4, 1)
chk23$ = "it" + MID$(disk4$, 5, 1)
IF goodVtx(chk21$) AND goodVtx(chk24$) AND goodVtx(chk23$) THEN
FOR disk5 = 1 TO 7
IF used(disk5) = 0 THEN
used(disk5) = 1
FOR disk5o = 0 TO 5
disk5$ = RIGHT$(disk$(disk5), disk5o) + LEFT$(disk$(disk5), 6 - disk5o)
chk20$ = "k" + MID$(disk5$, 4, 1) + MID$(disk4$, 6, 1)
chk19$ = "ly" + MID$(disk5$, 5, 1)
chk15$ = "et" + MID$(disk5$, 6, 1)
IF goodVtx(chk20$) AND goodVtx(chk19$) AND goodVtx(chk15$) THEN
FOR disk6 = 1 TO 7
IF used(disk6) = 0 THEN
used(disk6) = 1
FOR disk6o = 0 TO 5
disk6$ = RIGHT$(disk$(disk6), disk6o) + LEFT$(disk$(disk6), 6 - disk6o)
chk11$ = "a" + MID$(disk6$, 5, 1) + MID$(disk5$, 1, 1)
chk7$ = "to" + MID$(disk6$, 6, 1)
chk3$ = "or" + MID$(disk6$, 1, 1)
chk4$ = "a" + MID$(disk1$, 6, 1) + MID$(disk6$, 2, 1)
IF goodVtx(chk11$) AND goodVtx(chk7$) AND goodVtx(chk3$) AND goodVtx(chk4$) THEN
FOR disk7 = 1 TO 7
IF used(disk7) = 0 THEN
used(disk7) = 1
FOR disk7o = 0 TO 5
disk7$ = RIGHT$(disk$(disk7), disk7o) + LEFT$(disk$(disk7), 6 - disk7o)
chk8$ = MID$(disk7$, 1, 1) + MID$(disk6$, 3, 1) + MID$(disk1$, 5, 1)
chk9$ = MID$(disk7$, 2, 1) + MID$(disk1$, 4, 1) + MID$(disk2$, 6, 1)
chk13$ = MID$(disk7$, 3, 1) + MID$(disk2$, 5, 1) + MID$(disk3$, 1, 1)
chk17$ = MID$(disk7$, 4, 1) + MID$(disk3$, 6, 1) + MID$(disk4$, 2, 1)
chk16$ = MID$(disk7$, 5, 1) + MID$(disk4$, 1, 1) + MID$(disk5$, 3, 1)
chk12$ = MID$(disk7$, 6, 1) + MID$(disk5$, 2, 1) + MID$(disk6$, 4, 1)
IF goodVtx(chk8$) AND goodVtx(chk9$) AND goodVtx(chk13$) AND goodVtx(chk17$) AND goodVtx(chk16$) AND goodVtx(chk12$) THEN
PRINT disk1; disk1o; " "; disk2; disk2o; " "; disk3; disk3o; " "; disk4; disk4o; " "; disk5; disk5o; " "; disk6; disk6o; " "; disk7; disk7o
PRINT disk1$; " "; disk2$; " "; disk3$; " "; disk4$; " "; disk5$; " "; disk6$; " "; disk7$
PRINT
PRINT goodVtx2$(chk1$), goodVtx2$(chk2$), goodVtx2$(chk3$), goodVtx2$(chk4$)
PRINT goodVtx2$(chk5$), goodVtx2$(chk6$), goodVtx2$(chk7$), goodVtx2$(chk8$)
PRINT goodVtx2$(chk9$), goodVtx2$(chk10$), goodVtx2$(chk11$), goodVtx2$(chk12$)
PRINT goodVtx2$(chk13$), goodVtx2$(chk14$), goodVtx2$(chk15$), goodVtx2$(chk16$)
PRINT goodVtx2$(chk17$), goodVtx2$(chk18$), goodVtx2$(chk19$), goodVtx2$(chk20$)
PRINT goodVtx2$(chk21$), goodVtx2$(chk22$), goodVtx2$(chk23$), goodVtx2$(chk24$)
PRINT
END IF
NEXT
used(disk7) = 0
END IF
NEXT disk7
END IF
NEXT
used(disk6) = 0
END IF
NEXT disk6
END IF
NEXT
used(disk5) = 0
END IF
NEXT disk5
END IF
NEXT
used(disk4) = 0
END IF
NEXT disk4
END IF
NEXT
used(disk3) = 0
END IF
NEXT disk3
END IF
NEXT
used(disk2) = 0
END IF
NEXT disk2
END IF
NEXT
used(disk1) = 0
END IF
NEXT disk1
CLOSE 2
END
FUNCTION goodVtx (x$)
IF isWord(x$) THEN goodVtx = 1: EXIT FUNCTION
IF isWord(MID$(x$, 2) + LEFT$(x$, 1)) THEN goodVtx = 1: EXIT FUNCTION
IF isWord(MID$(x$, 3) + LEFT$(x$, 2)) THEN goodVtx = 1: EXIT FUNCTION
goodVtx = 0
END FUNCTION
FUNCTION goodVtx2$ (x$)
gv$ = ""
IF isWord(x$) THEN gv$ = x$
IF isWord(MID$(x$, 2) + LEFT$(x$, 1)) THEN
IF gv$ = "" THEN
gv$ = MID$(x$, 2) + LEFT$(x$, 1)
ELSE
gv$ = gv$ + "|" + MID$(x$, 2) + LEFT$(x$, 1)
END IF
END IF
IF isWord(MID$(x$, 3) + LEFT$(x$, 2)) THEN
IF gv$ = "" THEN
gv$ = MID$(x$, 3) + LEFT$(x$, 2)
ELSE
gv$ = gv$ + "|" + MID$(x$, 3) + LEFT$(x$, 2)
END IF
END IF
goodVtx2$ = gv$ + " "
END FUNCTION
FUNCTION isWord (w$)
w1$ = SPACE$(3)
low = 1: high = l
DO
mid = INT((low + high) / 2)
GET #2, (mid - 1) * 3 + 1, w1$
IF w1$ = w$ THEN isWord = 1: EXIT FUNCTION
IF w1$ < w$ THEN low = mid + 1: ELSE high = mid - 1
LOOP UNTIL low > high
isWord = 0
END FUNCTION
finds
7 0 1 2 5 3 6 1 2 0 4 2 3 5
ytssen yoiyal rrsaxf uuolpl botesl fmrcrm tyybsa
may ton for man
sty top|opt tom ret
sly oil arb|bar oca
yar|rya rye let uts
fub sat sly elk
fox aim pit lit
7 5 1 2 5 3 6 1 2 0 3 2 4 3
tsseny yoiyal rrsaxf uuolpl botesl bsatyy mfmrcr
mat ons|son orb ays|say
sty top|opt toy man
elf oil bay rot
mar|arm rye let cut
fur sat sly elk
fox aim pit lit
indicating that two solutions were found, but the first solution cannot avoid uncommon words, such as oca, yar or rya, uts, and fub.
In the second solution, all uncommon words have an alternative common word (son rather than ons; say rather than ays). In two instances there are two common interpretations: top or opt and mar or arm.
The lines
7 5 1 2 5 3 6 1 2 0 3 2 4 3
tsseny yoiyal rrsaxf uuolpl botesl bsatyy mfmrcr
are interpreted by taking the positions for disks on the board starting at the 12 o'clock position and going clockwise, then taking the central position. So the disk to be placed at the top is disk 7 and the one in the center is disk 4. The number after each disk number is the number of positions clockwise that that individual disk must be rotated to make the solution work. The set of letters below the two numbers is the content of that disk shown with the letter at the 11 o'clock position listed first, so for example, the T of disk 7 is placed near the MA at the top--at the 11 o'clock position.
A O
M T S N
R A Y S T P
O B S Y O T
O N E L
Y A L I
T M F O
Y T A Y
A R M E
B O R R
T C R A
L T F S
E U U T
Y S E X A I
L K L O F M
T P L I
I T
|
Posted by Charlie
on 2012-06-20 17:58:17 |