Anonymous user
Two bullet roulette: Difference between revisions
m
→{{header|REXX}}: added which of the options had the highest percentage of deaths as per the task's requirement.
m (→{{header|REXX}}: added a comment.) |
m (→{{header|REXX}}: added which of the options had the highest percentage of deaths as per the task's requirement.) |
||
Line 815:
if datatype(seed, 'W') then call random ,,seed /* " " " " " " */
cyls_ = cyls - 1 /*shortcut placeholder for cylinders-1 */
abc= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' /*indices for the various options used.*/
scenarios= 'LsLsFsF LsLsFF LLsFsF LLsFF' /*the list of scenarios to be tested. */
#= words(scenarios) /*the number of actions in a scenario. */
/*The scenarios are case insensitive. */
do m=1 for #; q= word(scenarios, m)
sum= 0 /*initialize the sum to zero. */
do tests; sum= sum +
say act() ' (option' substr(abc, m, 1)") produces " pc ' deaths.'
end /*m*/
exit 0 /*stick a fork in it, we're all done. */
Line 831 ⟶ 833:
spin: ?= random(1, cyls); if ?\==cyls then @= substr(@ || @, ? + 1, cyls); return
/*──────────────────────────────────────────────────────────────────────────────────────*/
method:
if
if
end /*a*/; return 0
/*──────────────────────────────────────────────────────────────────────────────────────*/
if
if
if
end /*j*/; return right( strip( strip($, , ",") ),
{{out|output|text= when using the default inputs, showing that 2<sup>nd</sup> option '''B''' has the highest probability for a suicide:}}
<pre>
</pre>
|