21 game: Difference between revisions

Added uBasic/4tH version
(Applesoft BASIC)
(Added uBasic/4tH version)
Line 6,200:
</lang>
 
=={{header|uBasic/4tH}}==
{{trans|FreeBASIC}}
<lang>dim @p(4)
 
push 1, 1, 3, 2
for i = 3 to 0 step -1 : @p(i) = pop() : next
a = 0 : t = rnd(2)
do while s < 21
t = 1 - t
print using "The sum is _#"; s
if t = 1 then
print "It is your turn."
do
while (a < 1) + (a > 3) + (a+s > 21)
input "How many would you like to add? ", a
loop
else
print "It is the computer's turn."
a = @p(s % 4)
print using "The computer adds #."; a
endif
 
print
s = s + a
a = 0
loop
if t = 1 then
print "Congratulations. You win."
else
print "Bad luck. The computer wins."
endif</lang>
=={{header|Visual Basic .NET}}==
 
374

edits