Question: overall Assignment For this assignment, you are to write a simple computer program which will use arrays to create a deck of cards, shuffle the

 overall Assignment For this assignment, you are to write a simple
computer program which will use arrays to create a deck of cards,
shuffle the deck, deal some hands, and print out the dealt hands.

overall Assignment For this assignment, you are to write a simple computer program which will use arrays to create a deck of cards, shuffle the deck, deal some hands, and print out the dealt hands. Possible optional enhancements include classifying the hands in a manner similar to a recent lab exercise. Representing Playing Cards Standard playing cards can be easily represented using two integers: One ranging from 0 to 12 for the ranks (numbers)ofthe cards ranging from deuce (2) to ace, and one ranging from 0 to 3 representing the 4 suits, as shown in the following tables: Suit Value Represents Rank value Represents Clubs rank 2 0 to 8 Diamonds Jack Hearts 10 Queen Spades King 12 Ace Creating an ordered Deck of Cards The best way to create a shuffled deck of cards to first create an ordered deck of cards, and then shuffle it. This approach guarantees that every card is represented exactly on with no missing cards duplicates, and it does so in a reasonable time. and "ranks", each Key to or arrays, named suits" storing the deck of cards will be two containing room for 52 integers. Each card in the deck will be represented by matching entries in the two arrays. For example, the 10th card in the deck will have a suit according to the 10th element in the suits[ array, and a rank number according to the 10th element in the ranks[Jarray. "i"), that varies from 0 to 51 inclusive To fill the arrays, create a loop with an integer, say o In the suitsl Jarray for position i, store i%4. Convince yourselfthat this will generate the series 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, sets of the sequence 0, 1,2, 3. o In the ranks[ Jarray for position i, store i/4. Convince yourself that this will generate the series 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 12, 12, e. 13 sets of 4 matching integers The resulting deck should look like this: Rank 0 0 0 1 1 1 12 12 12 12 Card 2 C 2 D 2 H 2 C 3 D 3 H 3 ST. AC AD AHAS S 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!