Reference no: EM1345023
Q1) In this assignment you will need the Visual Basic language features. A convenient way to determine different poker hands is to keep track of the cards in a player's hand with a table array of rows and columns. Row 1 tracks the clubs dealt, row 2 the diamonds, row 3 the hearts, and row 4, the spades. Column 1 tracks the aces, column 2, the twos, and so on through column 10. Column 11 tracks the Jacks, column 12 the queens, and column 13 the kings. If the name of the table is "cards" then cards(i,j) is set to 1 if the player is dealt face value j in suit i; otherwise cards(i,j) is set to 0. For example, if cards(2,11) = 1 then the player holds the jack of diamonds. Row 0 and Column 0 are not used. A card is represented by a String that indicates the card's face value followed by the suit. The face value is one of the Strings : "A", "2", "3", ..., "9", "10", "J", "Q", or "K". The suit is given by one of the letters "C" (clubs), "D" (diamonds), "H" (hearts), or "S" (Spades). Thus "AH" represents the ace of hearts and "10S" the ten of spades. A poker hand of 5 cards will be represented by a String of cards, each separated from the next by a comma. For example, the String : "aH, AS, 2D, 3C, 4C" describes a hand consisting of the ace of hearts, ace of spades, two of diamonds, three of clubs, and four of clubs. Note that spaces may occur between cards, but not between the face value and suit of any card. The user may specify a suit or the ace in either upper or lower case.
1. For each of the following types of poker hands design a Sub procedure that will recognize the hand in the table cards and, if observed, add the corresponding phrase to the ListBox:
a. Four of a kind
b. Three of kind
c. A pair
d. A flush
e. A straight, if ace is low.
f. An ace-high straight; that is the sequence: 10, J, Q, K, A
2. To observe the behavior of your Sub Procedures, design a Form that analyzes a poker hand entered by the user and displays the type of hand as indicated in (1). Your program should include the following:
a. A TextBox for the user to type in a poker hand.
b. A ListBox to display the result of the analysis. Note that a hand may have more than one description. For example, a hand may hold a full house; that is, a pair and three of a kind. Both descriptions should be displayed. However, four of a kind should not also be described as two pair.