Two bullet roulette: Difference between revisions
Content added Content deleted
(→{{header|REXX}}: added the computer programming language REXX.) |
m (→{{header|REXX}}: simplified the code, add some wording to the REXX section header.) |
||
Line 803: | Line 803: | ||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
{{trans|GO}} |
{{trans|GO}} |
||
This REXX version eliminates the spinning of the bullet chamber if the random number for a spin is '''6''' (which would |
|||
<br>normally just spin the bullet chamber around to its initial position, thereby saving some busywork by the program). |
|||
<lang rexx>/*REXX pgm simulates scenarios for a two─bullet Russian roulette game with a 6 cyl. gun.*/ |
<lang rexx>/*REXX pgm simulates scenarios for a two─bullet Russian roulette game with a 6 cyl. gun.*/ |
||
parse arg cyls tests seed . /*obtain optional arguments from the CL*/ |
parse arg cyls tests seed . /*obtain optional arguments from the CL*/ |
||
Line 835: | Line 838: | ||
if act=='S' then $= $", spin" |
if act=='S' then $= $", spin" |
||
if act=='F' then $= $", fire" |
if act=='F' then $= $", fire" |
||
end /*j*/; return right |
end /*j*/; return right( strip($, , ","), 50)</lang> |
||
{{out|output|text= when using the default inputs:}} |
{{out|output|text= when using the default inputs:}} |
||
output |
output |