Solved
Help on Loop
Posted on 1998-07-11
I have to figure out how to do this. This is a similiar situation, if you can show me how to do this, I can apply it to my situation:
I need to have a subprogram show the results of
Using 5 textboxes and
some string functions. The output would look like this:
A 1 2 3 4 5 6 7 8 9 10 J Q K
club 0 1 1 0 0 0 1 1 2 1 1 0 0
diamond ect
heart ect
spade ect
basically I need to write program that requests the five cards as input from the user,using textbox, creates the related array, and passes the array to subprograms to determine the type of the hand: flush (all cards have the same suit), four-of-a-kind, full house (3 cards of one denomination, 2 cards of another denomination), three-of-a-kind, two pairs, one pair, or none of the above.
For example, a user inputs C4(four of clubs), C6,
H3(three of hearts), DK(king of diamonds), SQ(queen of spades) into five
textboxes respectively. Then for each card, identify suit and number by
using, for instance, Left(txtCard1.Text, 1) and Right(txtCard1.Text, 1),
and assign 1 to appropriate element in two dimensional array . (Of course you need to convert letters such as A, J, Q, and K into
numbers.)
2. Use two arrays of counters: One for numbers and the other for suits.
Of course, the size of array for number counters should be 13, and that of
array for suit counters should be 4. scan this array of flag by using
nested For Next loop. While scanning this table count how many 1's for each suit and each number. With these two arrays of counters, determine the type of the hand. For example, if you have 5 of counter in any suit, it's flush. If you have 4 of counter in any number, it's
four-of-a-kind. And so on.
I don't even know where to start. I appreciate any help. I know there are other ways to do this. but I need to do it the way stated above.
Thanks!