Jump to content

Word search: Difference between revisions

502 bytes removed ,  6 years ago
m
"give up" no longer required when overlaps allowed.
m (removed overlap checks)
m ("give up" no longer required when overlaps allowed.)
Line 589:
 
=={{header|Phix}}==
Once it gets stuck it gets really stuck; there are many ways to try cramming 24,000+ words into a hole where they simply cannot fit. <br>
So after (just) 0.1s, it gives up and starts with a clean board, any longer that that proved to be counterproductive.
<lang Phix>--
-- demo\rosetta\wordsearch.exw
Line 597 ⟶ 595:
string message = "ROSETTACODE"
sequence words, solution="", placed
constant maxt = 0.1
atom t1 = time()+maxt
 
constant grid = split("""
Line 656 ⟶ 652:
end if
end if
if time()>t1 then return end if
end for
end if
Line 686 ⟶ 681:
printf(1,"%d words loaded\n",length(words))
 
wordsearch(grid,25,100,{{},{}})
while 1 do
t1 = time()+maxt
wordsearch(grid,25,100,{{},{}})
if length(solution) then exit end if
?"stuck, retry"
end while
for x=2 to 11 do
for y=4 to 31 by 3 do
Line 710 ⟶ 700:
<pre>
24820 words loaded
"stuck, retry"
"stuck, retry"
"stuck, retry"
0 1 2 3 4 5 6 7 8 9
0 l o v e s d R p u n
7,813

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.