Word wheel: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 1,808: | Line 1,808: | ||
begin |
begin |
||
AssignFile(WordList, WordFile); |
AssignFile(WordList, WordFile); |
||
try |
|||
Reset(WordList); |
Reset(WordList); |
||
except |
|||
⚫ | |||
if IOResult <> 0 then |
|||
exit; |
|||
⚫ | |||
⚫ | |||
exit; |
|||
⚫ | |||
Allowed := LowerCase(pattern); |
Allowed := LowerCase(pattern); |
||
Required := copy(Allowed, 5, 1); |
Required := copy(Allowed, 5, 1); { central letter is required } |
||
while not eof(WordList) do |
while not eof(WordList) do |
||
begin |
begin |
||
readln(WordList, w); |
readln(WordList, w); |
||
Len := length(w); |
Len := length(w); |
||
⚫ | |||
if (Len < MinLength) or (Len > WheelSize) then continue; |
if (Len < MinLength) or (Len > WheelSize) then continue; |
||
if pos(Required, w) = 0 then continue; |
if pos(Required, w) = 0 then continue; |
||
⚫ | |||
Match := True; |
Match := True; |
||
for i := 1 to Len do |
for i := 1 to Len do |
||
Line 1,845: | Line 1,843: | ||
{ exercise the procedure } |
{ exercise the procedure } |
||
begin |
begin |
||
search(' |
search('NDE' + 'OKG' + 'ELW'); {3 x 3 letter grid } |
||
end. |
end. |
||
</lang> |
</lang> |