Two bullet roulette: Difference between revisions

(→‎{{header|Vlang}}: Rename "Vlang" in "V (Vlang)")
Line 453:
=={{header|EasyLang}}==
{{trans|C}}
<syntaxhighlight lang="text">len cyl[] 6
len cyl[] 6
func rshift . .
h = cyl[56]
for i = 56 downto 12
cyl[i] = cyl[i - 1]
.
cyl[01] = h
.
func unload . .
for i range= 1 to 6
cyl[i] = 0
.
.
func load . .
while cyl[01] = 1
call rshift
.
cyl[01] = 1
call rshift
.
func spin . .
lim = random 6 + 1
for i = 1 to lim - 1
call rshift
Line 480 ⟶ 481:
.
func fire . shot .
shot = cyl[01]
call rshift
.
Line 487 ⟶ 488:
shot = 0
for m in m[]
if m = 01
call load
elif m = 12
call spin
elif m = 23
call fire shot
if shot = 1
Line 502 ⟶ 503:
func test m[] . .
n = 100000
for i range= 1 to n
call method m[] shot
sum += shot
.
for mi in= 1 to len m[]
write method$[m[i]] & " "
.
print "-> " & 100 * sum / n & "% deathsdeath"
.
call test [ 0 1 02 1 2 13 2 3 ]
call test [ 0 1 02 1 2 23 3 ]
call test [ 0 01 1 2 13 2 3 ]
call test [ 0 01 1 2 23 3 ]</syntaxhighlight>
</syntaxhighlight>
 
=={{header|Factor}}==
1,969

edits