100 prisoners: Difference between revisions

added Arturo
m (BASIC256 moved to the BASIC section.)
(added Arturo)
Line 880:
Optimal strategie : 303 sur 1000
</pre>
=={{header|Arturo}}==
 
<syntaxhighlight lang="arturo">unplanned: function [][
drawers: shuffle @1..100
every? 1..100 'x -> some? 1..50 => [x = sample drawers]
]
 
planned: function [][
drawers: shuffle @1..100
every? 1..100 'x [
next: x
some? 1..50 => [x = next: <= drawers\[next-1]]
]
]
 
test: function [f][
count: enumerate 10000 => [call f []]
print [f ~"|mul fdiv count 10000 100|%"]
]
 
test 'unplanned
test 'planned</syntaxhighlight>
 
{{out}}
 
<pre>unplanned 0.0%
planned 31.43%</pre>
 
=={{header|AutoHotkey}}==
<syntaxhighlight lang="autohotkey">NumOfTrials := 20000
1,532

edits