Anonymous user
Set puzzle: Difference between revisions
m
moved Categorys to top
Walterpachl (talk | contribs) m (→{{header|REXX}}: it's -> its) |
m (moved Categorys to top) |
||
Line 2,113:
=={{header|Tcl}}==
The principle behind this code is that the space of possible solutions is a substantial proportion of the space of possible hands, so picking a random hand and verifying that it is a solution, repeating until that verification succeeds, is a much quicker way to find a solution than a systematic search.
It also makes the code substantially simpler.
<lang tcl># Generate random integer uniformly on range [0..$n-1]
proc random n {expr {int(rand() * $n)}}
Line 2,294 ⟶ 2,295:
(red,squiggle,two,open)
</pre>
|