PLAYER = 1 COMP = 0 sum = 0 total = 0 turn = int(ran() + 0.5) dim precomp(3) precomp(0) = 1 : precomp(1) = 1 precomp(2) = 3 : precomp(3) = 2 while sum < 21 turn = 1 - turn print "The sum is ", sum if turn = PLAYER then print "It is your turn." while total < 1 or total > 3 or total + sum > 21 input "How many would you like to total? " total wend else print "It is the computer's turn." total = precomp(mod(sum, 4)) print "The computer totals ", total, "." fi print sum = sum + total total = 0 wend if turn = PLAYER then print "Congratulations. You win." else print "Bad luck. The computer wins." fi