21 game: Difference between revisions

1-based index
(→‎{{header|Vlang}}: Rename "Vlang" in "V (Vlang)")
(1-based index)
Line 2,291:
<syntaxhighlight lang="text">print "Who reaches 21, wins"
print "Do you want to begin (y/n)"
who = 1
if input = "n"
who = 12
.
who$[] = [ "Human" "Computer" ]
repeat
if who = 01
repeat
print ""
Line 2,307 ⟶ 2,308:
sleep 1
if sum mod 4 = 1
n = random 3 + 1
else
n = 4 - (sum + 3) mod 4
Line 2,315 ⟶ 2,316:
print who$[who] & ": " & n & " --> " & sum
until sum >= 21 or a$ = "q"
who = (who + 1) mod 2 + 1
.
if a$ <> "q"
2,052

edits