# Blackjack Game (Sample Programs)

Here are three updated subroutines to draw card faces based on my old example program:

subroutine drawcardback(x,y,w,h)
# draw a moire pattern for the back of a card
call drawcardborder(x,y,w,h)
color blue
for t = 3 to w step 4
line x+2,y+2,x+t,y+h-2
next t
for t = 3 to h step 4
line x+2,y+2,x+w-2,y+t
next t
end subroutine

subroutine drawcardborder(x,y,w,h)
# draw blank card with border
color blue
rect x,y,w,h
color white
rect x+2,y+2,w-4,h-4
end subroutine

subroutine drawcard(x,y,w,h,suite\$, card\$)
# drawcard - draw a w,h card at the location x,y
# on the screen.
# set suite\$ to H D S or C
# and card\$ to A 2 3 4 5 6 7 8 9 10 J Q K
#
call drawcardborder(x,y,w,h)
color black
if suite\$ = "H" or suite\$ = "D" then color red
# stamp suit on card
if suite\$ = "H" then stamp x+(w-h/3*.8)/2, y+h/2, h/3, {0,.2, 0,.4, .1,.7, .4,1, .7,.7, .8,.4, .8,.2, .7,0, .5,0, .4,.1, .3,0, .1,0}
if suite\$ = "D" then stamp x+(w-h/3*.8)/2, y+h/2, h/3, {0, .5, .4, 0, .8, .5, .4, 1}
if suite\$ = "S" then stamp x+(w-h/3*.8)/2, y+h/2, h/3, {0,.5, 0,.6, .1,.7, .3,.6, .2,.9, .2,1, .4,1, .6,1, .6,.9, .5,.6, .7,.7, .8,.6, .8,.5, .7,.3, .4,0, .1,.3 }
if suite\$ = "C" then stamp x+(w-h/3*.8)/2, y+h/2, h/3, {0,.2, .1,.3, .3,.4, .1,.4, 0,.6, .1,.8, .2,.8, .3,.7, .2,1, .6,1, .5,.7, .6,.8, .7,.8, .8,.6, .7,.4, .5,.4, .7,.3, .8,.2, .7,0, .5,0, .4,.1, .3,0, .1,0}
# now show card value
font "tahoma",h/4,100
text x + w/8, y + h/16, card\$
end subroutine

You can
call drawcardback(top, left, width, height)
to draw a card's back. Then call
call drawcard(top, left, width, height, suite\$, value\$)
to draw the card's face.

These functions should scale from small to large without much need for changes. Also I created new stamp arrays for the shapes to make them a bit smoother.

I am looking forward to the completed game.

Jim