Question: Write a function comp1thetae1huxxy_valtd_table() which takes a single argument: - groups, a list of lists of cards (each a 2-element string, where the first letter

 Write a function comp1\thetae1huxxy_valtd_table() which takes a single argument: - groups,

Write a function comp1\thetae1huxxy_valtd_table() which takes a single argument: - groups, a list of lists of cards (each a 2-element string, where the first letter is the card value and the second letter is the card suit, eg. '3H' for the 3 of Hearts), where each list of cards represents a single group on the table, and the combined list of list: represents the combined groups played to the table. Your function should return a bool, which evaluates whether the table state is valid or not. Recall from the rules of the game that the table is valid if all groups are valid, where a group can take one of the following two forms: - an $\mathrm{N}$-of-a-kind ( (i.e. three or more cards of the same value), noting that in the case of a 3-of-a-kind, each card must have a unique suit (eg. $\left('25^{\prime}, '{25}^{\prime},}^{\prime} 2 \mathrm{C}^{\prime} ight]$ is not a valid 3 -of-a-kind, as the Two of Spades has been played twice), and if there are 4 or more cards, all suits must be present. - a run (i.e. a group of 3 or more cards, starting from the lowest- valued card, and ending with the highest-valued card, forming a continuous sequence in terms of value, and alternating in colour; note that the specific ordering of cards in the list is not significant, Le. $\left[' 2 \mathrm{C}^{\prime), -' 30^{\prime}, -! 45^{\prime} ight]$ and $\left[' 4 \mathrm{-S}^{\prime}, ight.$, Example function calls are as follows: CS.VS. 933|

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!