I am doing a card game with 5 cards in my hand.
but when the program should check if i got pair or something i have to write so much.
the five card get numbers between 1 - 52 so it can look like this: card(1) = 3
How do i check if i got pair.......
Card game
Moderators:Administrator, Global Moderator
- frankiebaby
- Global Moderator
- Posts:95
- Joined:Tue Apr 30, 2002 1:38 am
- Location:Pennsylvania
- Contact:
Re: Card game
Well, this always works:
PAIR = 0
PAIR_IS = 0
For x = 1 to 5
for y = 1 to 5
if Card(X) = Card(Y) then
PAIR = PAIR + 1
PAIR_IS = CARD(X)
end if
next
next
if pair then print "YOU HAVE A PAIR OF"; PAIR_IS; "!"
this does not, however, check for two or more pair, but could be easily modified to do so.
PAIR = 0
PAIR_IS = 0
For x = 1 to 5
for y = 1 to 5
if Card(X) = Card(Y) then
PAIR = PAIR + 1
PAIR_IS = CARD(X)
end if
next
next
if pair then print "YOU HAVE A PAIR OF"; PAIR_IS; "!"
this does not, however, check for two or more pair, but could be easily modified to do so.