I would use a array and UDT (User Defined Types) to assign values to the cards.
rem Define type
Type deck
suit as integer : rem 1=Hearts, 2=Diamond, etc
value as integer : rem ace=13, king=12, etc
Endtype
Dim card(52) as deck
You can load the values from loops
cardnum=1
For s=1 to 4
For v=1 to 13
card(cardnum).suit = s : rem Assign suit
card(cardnum).value = v : rem Assign value
inc cardnum : rem Increase card number
Next v
Next s
Then to see if a card can be placed on top of another you can do something like this:
Say the card that is down is number 3 (in this example it's the 3 of hearts) and the player wants to place card number 2 (the 2 of hearts) you can check:
down=3
place=2
If card(down).suit = card(place).suit : rem If suit is the same
rem If value of new card is exactly one less then value of down card
If card(down).value - card(place).value = 1
rem It's allowed so allow player to place card down
Endif
Endif
There are lots of other ways to do it but this is one.
It is not from the benevolence of the butcher, the brewer, or the baker, that we expect our dinner, but from their regard to their own interest. --Adam Smith