In each of the following, insert a word which completes the first and starts the second.
Each of the asterisks denotes a letter whether same or different.
(1) KID (***) KIN
(2) SEA (***) NET
(3) DO (***) NECK
(4) SAND (***) GAIN
(5) IMP (***) EAR
(6) WONDER (****) MARK
(7) RAM (****) RIDGE
(8) PHOTO (****) RIGHT
(9) BLUE (****) OWED
(10) FAN (****) WELL
(11) TROUBLE (****) THING
(12) EX (****) ACLE
(13) BOW (****) HAL
(14) MA (***) AGE
Notes:
(i) Plurals, Proper nouns, hyphens, spaces, acronyms and abbreviations are not allowed.
(ii) Some of the given parts may contain multiple solutions.
DECLARE FUNCTION isWord! (w$)
DATA kid***kin,sea***net,do***neck,sand***gain,imp***ear
DATA wonder****mark,ram****ridge,photo****right,blue****owed
DATA fan****well,trouble****thing,ex****acle,bow****hal,ma***age
DIM puz$(14)
FOR i = 1 TO 14: READ puz$(i): PRINT puz$(i): NEXT
FOR p = 1 TO 14
pz$ = puz$(p)
ix = INSTR(pz$, "*")
FOR i = ix + 1 TO LEN(pz$)
IF MID$(pz$, i, 1) <> "*" THEN ix2 = i: EXIT FOR
NEXT
w$ = SPACE$(ix2 - 1)
proto$ = LEFT$(pz$, ix - 1)
OPEN "\words\words" + LTRIM$(STR$(ix2 - 1)) + ".txt" FOR BINARY AS #1
DO
GET #1, , w$
IF EOF(1) THEN EXIT DO
IF LEFT$(w$, LEN(proto$)) = proto$ THEN
w2$ = MID$(w$, ix) + MID$(pz$, ix2)
IF isWord(w2$) THEN PRINT w$; " "; w2$
END IF
LOOP
CLOSE 1
NEXT
FUNCTION isWord (w$)
n = LEN(w$)
w1$ = SPACE$(n)
OPEN "\words\words" + LTRIM$(STR$(n)) + ".txt" FOR BINARY AS #2
l = LOF(2) / n
low = 1: high = l
DO
mid = INT((low + high) / 2)
GET #2, (mid - 1) * n + 1, w1$
IF w1$ = w$ THEN isWord = 1: CLOSE 2: EXIT FUNCTION
IF w1$ < w$ THEN low = mid + 1: ELSE high = mid - 1
LOOP UNTIL low > high
isWord = 0
CLOSE 2
END FUNCTION
finds, with a double solutions for blue(****)owed and ma(***)age but none for bow(****)hal:
kidnap napkin
season sonnet
dowry wryneck
sandbar bargain
impend endear
wonderland landmark
rampart partridge
photocopy copyright
bluebell bellowed
bluebill billowed
fanfare farewell
troublesome something
extent tentacle
madam damage
mavis visage
|
Posted by Charlie
on 2012-04-09 12:25:48 |