by JohnnyD
Hi all, Here's my solitaire game. QCARD32.DLL is required in the LB folder
The object of this game is to place cards in pairs over existing cards such that the value of each pair of covered cards adds up to eleven.
(e.g. 6 & 5, 7 & 4, Jack & Ace, etc)
Suits are irrelevant. Ace counts as one, picture cards count as ten.
A Jack-Queen-King sequence is also permitted.
nomainwindim saved(3,4):dim deck(52,2):dim pos(9,4)for a=0to3for b=1to13
deck(a*13+b,1)=a*13+b:deck(a*13+b,2)=b
next b
next a
restore[posn]for a=1to9read b,c:pos(a,1)=b:pos(a,2)=c
next a
[posn]data10,2,110,2,210,2,10,102,110,102,210,102,10,202,110,202,210,202WindowWidth=306:WindowHeight=382UpperLeftX=(DisplayWidth-WindowWidth)/2UpperLeftY=(DisplayHeight-WindowHeight)/2menu#1,"&Options","&Deal",[deal],"&Help",[help],"E&xit",[quit]graphicbox#1.g,0,0,300,330open"Patience"for window_nf as#1#1"trapclose [quit]"#1.g "setfocus; when leftButtonUp [checkIndex]"
hBox=hwnd(#1.g)open"qcard32.dll"fordllas#qc
calldll#qc,"InitializeDeck",hBox aslong,r aslong[deal]
dealt=0:clicks=0:card=0:score=0:pic=0
reclaim=0:dim jqk(3):nomore=0calldll#qc,"SetDefaultValues",r asvoidgosub[shuffle]#1.g "down; fill 10 190 225"#1.g "backcolor 10 190 225"for i=1to9Call DealCard hBox,deck(i,1),pos(i,1),pos(i,2)
pos(i,3)=deck(i,1):pos(i,4)=deck(i,2)
dealt=dealt+1next i
gosub[moretest][wait]#1.g "place 10 320"#1.g "\Cards Left:";52-dealt;" "if nomore=1thenconfirm"Play Again?";q$
if q$="yes"thengoto[deal]elsegoto[quit]endifendifwait[checkIndex]
x=MouseX:y=MouseYfor a=1to9if(x>pos(a,1))and(x<pos(a,1)+70)and(y>pos(a,2))and(y<pos(a,2)+95)thenexitfornext a
card=a
if a=10then
card=0:goto[wait]endif
dealt=dealt+1#1.g "place 80 320":#1.g "\";52-dealt;" "
clicks=clicks+1if pos(card,4)>10then
score=score+10else
score=score+pos(card,4)endif
saved(clicks,1)=card:saved(clicks,2)=pos(card,3):saved(clicks,3)=pos(card,4)Call DealCard hBox,deck(dealt,1),pos(card,1),pos(card,2)if pos(card,4)<11then[2pictest]
pic=pic+1if jqk(pos(card,4)-10)=pos(card,4)then[gotpic]
jqk(pos(card,4)-10)=pos(card,4)
pos(card,3)=deck(dealt,1):pos(card,4)=deck(dealt,2)if pic=3then[zeroscore]goto[2clicktest][gotpic]selectcase pos(card,4)case11name$="J"case12name$="Q"case13name$="K"endselectnotice"Already Have a ";name$;"!":dim jqk(3)[redeal]
reclaim=clicks:gosub[redealold][zeroscore]
score=0:pic=0:clicks=0:reclaim=0:dim jqk(3)gosub[moretest]goto[dealtall][2pictest]if pic=2thennotice"Can't Have ";pos(card,4);" in J-Q-K Run!"dim jqk(3)goto[redeal]endif[2clicktest]
pos(card,3)=deck(dealt,1):pos(card,4)=deck(dealt,2)if pic>1then[dealtall]if clicks=2then
reclaim=clicks:clicks=0if score <>11thendimname$(2)for a=1to2name$(a)=str$(saved(a,3))selectcasename$(a)case"1"name$(a)="A"case"11"name$(a)="J"case"12"name$(a)="Q"case"13"name$(a)="K"endselectnext a
noticename$(1)+" and "+name$(2)+" is not 11!"gosub[redealold]else
score=0:reclaim=0:pic=0:dim jqk(3)gosub[moretest]endifendif[dealtall]if dealt=52thenconfirm"You Did it! Play Again?";q$
if q$="yes"then[deal]else[quit]endifgoto[wait][shuffle]for a=1to500
b=int(rnd(0)*52)+1:c=int(rnd(0)*52)+1
d=deck(b,1):dd=deck(b,2)
deck(b,1)=deck(c,1):deck(b,2)=deck(c,2)
deck(c,1)=d:deck(c,2)=dd
next a
return[redealold]for a=1to reclaim
Call DealCard hBox,saved(a,2),pos(saved(a,1),1),pos(saved(a,1),2)
pos(saved(a,1),3)=saved(a,2):pos(saved(a,1),4)=saved(a,3)next a
dealt=dealt-reclaim:score=0:reclaim=0:pic=0:dim jqk(3)return[quit]close#qc:close#1:end[moretest]
more=0:nomore=0for a=1to8for b=a+1to9if pos(a,4)+pos(b,4)=11then more=1next b
next a
jqk=0for a=1to9if pos(a,4)>10then jqk=1next a
for a=1to9if pos(a,4)=1and jqk=1then more=1next a
dim jqktest(3)for a=1to9if pos(a,4)>10then jqktest(pos(a,4)-10)=1next a
if jqktest(1)=1and jqktest(2)=1and jqktest(3)=1then more=1if more=0then nomore=1:notice"No More Moves"return[help]
help$="Help"+chr$(13)
help$=help$+"The object of the game is place pairs of cards on"+chr$(13)
help$=help$+"existing cards such that each pair of covered cards"+chr$(13)
help$=help$+"adds up to eleven, until the pack is used up."+chr$(13)+chr$(13)
help$=help$+"Suit is irrelevant, Ace counts as one,"+chr$(13)
help$=help$+"picture cards count as ten."+chr$(13)
help$=help$+"Example moves are 6 & 5, 8 & 3, Jack & Ace, etc."+chr$(13)+chr$(13)
help$=help$+"A Jack - Queen - King run is also permitted."+chr$(13)
help$=help$+"Incorrrect moves will be indicated and the deck will back up."notice help$
waitSub DealCard hndle,nC,x,y
calldll#qc,"DealCard",hndle aslong,nC aslong,x aslong,y aslong,r asvoidEndSub
Patience
by JohnnyDHi all, Here's my solitaire game. QCARD32.DLL is required in the LB folder
The object of this game is to place cards in pairs over existing cards such that the value of each pair of covered cards adds up to eleven.
(e.g. 6 & 5, 7 & 4, Jack & Ace, etc)
Suits are irrelevant. Ace counts as one, picture cards count as ten.
A Jack-Queen-King sequence is also permitted.