#!/usr/local/bin/yabasic
dim blitdeck$(52), deck$(52),baraja(52)
dim offsetx(52),offsety(52),status(52),redraw(52)
ncards=21 : Dim Stacks(3,9) :delta=16
gosub Initialize
gosub InitCards
open window 530, 440
print "Guess Card 21 ver0.5, by Hermang Mansilla Mattos\nWait please, "
print "Shuffling and picking ",ncards," cards at random ... "
print "Next, You will be asked to pick a card \n"
gosub LoadDeckImages
gosub Shuffle
gosub ShowDeck
print "\nChoose a card, but keep it secret on your mind"
input "first memorize the card, then press Enter \n" dummy$
clear screen
text 105,20, "Group 1"
text 205,20, "Group 2"
text 305,20, "Group 3"
print "Now I will Spread the cards in 3 groups "
gosub SpreadCards
gosub AskGroup
clear rect 100,30 to 400,325
print "Lets join the 3 groups of cards ..."
gosub JoinGroups
rem changed
delta=3
gosub ShowDeck
print "\nAgain I will spread the cards, look in which group your card is."
gosub SpreadCards
gosub AskGroup
clear rect 100,30 to 400,325
print "Lets join the 3 groups of cards once more ..."
gosub JoinGroups
gosub ShowDeck
print "\nFinally, this is the last spreading of the cards ..."
gosub SpreadCards
gosub AskGroup
print "Your card is the Card Shown, isn't it?"
clear window
card=9+grupo
gosub ShowCard
print "Press any key to Quit"
k$=inkey$
end
Label Initialize
facedown=0
faceup=1
frameonly=2
hidden=3
hide=4
for card=1 to 52
redraw(card)=1
status(card)=faceup
rem offsetx(card)=mod(card-1,3)*100+100
rem offsety(card)=int((card-1)/3)*33+10
next card
return
Label InitCards
Cards$="AKQJD98765432"
Suits$="CSHD"
for n=1 to 52
card=1+int((n-1)/4)
suit=mod(n-1,4)+1
deck$(n)=mid$(Cards$,card,1) +mid$(Suits$,suit,1)
baraja(n)=n
next n
Return
Label LoadDeckImages
open 1, "deck.blt","r"
for i=0 to 52
line input #1 tmp$
line input #1 temp$
blitdeck$(i)=tmp$+temp$
next i
close 1
return
Label ShowCards
for card=1 to ncards
if redraw(card)=1 then gosub ShowCard
redraw(card)=0
fi
next card
return
Label SpreadCards
for card=1 to ncards
k$=inkey$(0.1)
if k$="q" then end fi
if card3 then goto AskGroup fi
return
               (
geocities.com/sunsetstrip/palms/1624/yabasic)                   (
geocities.com/sunsetstrip/palms/1624)                   (
geocities.com/sunsetstrip/palms)                   (
geocities.com/sunsetstrip)