There is one "quirk" not yet fixed: when selecting the last card in a row,
clicking outside the area of a normal card lap will cause an error.
'KenoCard by jaba'Sept 09, 2011'Rev. 1'This program uses the qcard32.dll which must be in the same folder as this'program.dim card(52)'card index for full deck before shuffledim x(52), y(52)dim d(20)dim cs(7)nomainwinWindowWidth=750:WindowHeight=600UpperLeftX=1:UpperLeftY=1menu#1,"&File","P&lay again",[start],"E&xit",[quit]graphicbox#1.g,0,0,750,570open"KenoCard Game"for window_nf as#1#1"trapclose [quit]"
hBox=hWnd(#1.g)open"qcard32.dll "fordllas#qc
call InitializeDeck hBox
[start]#1.g "cls"
cnt =0
cardSelected =0redim cs(7)#1.g "font arial 12 bold;color black"#1.g "down; fill 10 225 127"#1.g "backcolor 10 225 127;place 20 20;\PLAY KENOCARD - ";_
"Click to select 7 cards. ";_
"3 or more matches and you win!"[fillCardArray]for i =1to52
card(i)=i ':print card(i)next[shuffleCards]for i =1to52
newIndex=int(rnd(0)*52)+1
tempCard=card(i)
card(i)=card(newIndex)
card(newIndex)=tempCard
next[dealDeck]
y=30
j=0for i =1to52
j=j+1call SetCardStatus card(i),1call DealCard hBox, card(i), j*24, y
x(i)=j*24:y(i)=y
call Pause 20if i mod26=0then y = y+110:j=0next i
gosub[drawBoxes]#1.g "setfocus; when leftButtonDown [selectCard]"wait[drawBoxes]#1.g "color yellow; size 2"
h=80:y=266for i =1to7
x=i*h
#1.g "place ";x;" "; y
#1.g "box ";x+76;" ";y+104next i
return[selectCard]
mx=MouseX:my=MouseY'if mouse is within visible part of card, get' that card's indexif my >30AND my <130thenfor i =1to26if mx >x(i)AND mx <x(i)+24then
cardSelected=card(i)exitforendifnext i
endifif my >140AND my <240thenfor i =27to52if mx >x(i)AND mx <x(i)+24then
cardSelected=card(i)exitforendifnext i
endif'check if user selects same card more than oncegosub[checkDoubles]if dbl thenwait'count number of selections
cnt=cnt+1#1.g "place 24 260;color black;\ ";7-cnt
cs(cnt)=cardSelected
call SetCardStatus cs(cnt),1call DealCard hBox, cs(cnt),((cnt)*80)+2,270call Pause 20if cnt=7then[stopSelecting]wait[stopSelecting]#1.g "place 30 410;color yellow;\Please wait..."#1.g "setfocus; when leftButtonDown"call Pause 1000
cnt=0for i =1to52
newIndex=int(rnd(0)*52)+1
tempCard=card(i)
card(i)=card(newIndex)
card(newIndex)=tempCard
nextfor i =1to20call SetCardStatus card(i),1call DealCard hBox, card(i), i*31,420'24call Pause 20for j =1to7if card(i)=cs(j)then cnt=cnt+1next j
next i
#1.g "place 30 535;color black"#1.g "\You got " ;cnt; " matches."if cnt >2thengosub[youWin]elsegosub[youLose]endifgoto[playagain]wait[youWin]#1.g "place 280 400;font arial 20 bold;color red;\YOU WIN!!"return[youLose]#1.g "place 280 400;font arial 20 bold;color black;\YOU LOSE!!"return[checkDoubles]
dbl=0for k =1to cnt
if cardSelected = cs(cnt)thennotice"Please make another selection."
dbl=1
cardSelected =0endifnext k
return[playagain]timer1000,[ok]wait[ok]timer o
confirm"Play again?";yn$
if yn$ ="yes"thengoto[start][quit]close#qc
close#1end'========================================================'subs and functions'========================================================sub Pause ms
'pause ms number of millisecondscalldll#kernel32,"Sleep",_
ms aslong,_
re asvoidendsubsub InitializeDeck hndle
calldll#qc,"InitializeDeck",_
hndle asulong,_
r aslongendsubsub DealCard hndle,nC,x,y
'places cards on window whose handle is hndle at x,y'nC is number of card - 1-52 in first deck and'53-104 in second deck, if usedcalldll#qc,"DealCard",_
hndle asulong,_
nC aslong,_
x aslong,_
y aslong,_
r asvoidendsubsub SetCardStatus nC, face
'nC is number of card - 1-52 in first deck and'53-104 in second deck if used'face: 0=facedown, 1=faceupcalldll#qc,"SetCardStatus",_
nC aslong,_
face aslong,_
r asvoidendsub
There is one "quirk" not yet fixed: when selecting the last card in a row,
clicking outside the area of a normal card lap will cause an error.