Hit The Order Button To Order A **Custom Paper**

>> CLICK HERE TO ORDER 100% ORIGINAL PAPERS FROM AustralianExpertWriters.com <<

30 Jun
2020

Write a function which takes a single argument

Category:ACADEMICIAN

SOLUTION AT Australian Expert Writers

Write a function comp10001huxxy_valid_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, e.g. ‘3H’ for the 3 of Hearts), where each list of cards represents a single group on the table, and the combined list of lists 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 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 (e.g. [‘2S’, ‘2S’, ‘2C’] 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, i.e. [‘2C’, ‘3D’, ‘4S’] and [‘4S’, ‘2C’, ‘3D’] both make up the same run.Example function calls are as follows:>>> comp10001huxxy_valid_table([])True>>> comp10001huxxy_valid_table([[‘AC’]])False>>> comp10001huxxy_valid_table([[‘AC’, ‘2S’]]) # run too shortFalse>>> comp10001huxxy_valid_table([[‘AC’, ‘2S’, ‘3H’]]) # run doesn’t alternate in colourFalse>>> comp10001huxxy_valid_table([[‘AC’, ‘2S’, ‘4H’]]) # values not adjacentFalse>>> comp10001huxxy_valid_table([[‘AC’, ‘2H’, ‘3S’]])True>>> comp10001huxxy_valid_table([[‘3C’, ‘AS’, ‘2H’]]) # test unsorted runTrue>>> comp10001huxxy_valid_table([[‘0C’, ‘JH’, ‘QS’, ‘KH’, ‘9D’]])True>>> comp10001huxxy_valid_table([[‘2C’, ‘2H’]]) # n-of-kind too shortFalse>>> comp10001huxxy_valid_table([[‘2C’, ‘2H’, ‘2C’]]) # same suit twice for 3-of-kindFalse>>> comp10001huxxy_valid_table([[‘2C’, ‘2H’, ‘2S’, ‘2C’]]) # same suit twice for 4-of-kindFalse>>> comp10001huxxy_valid_table([[‘2C’, ‘2H’, ‘2S’]])True>>> comp10001huxxy_valid_table([[‘2C’, ‘2H’, ‘2S’, ‘2D’]])True>>> comp10001huxxy_valid_table([[‘2C’, ‘2H’, ‘2S’, ‘2D’, ‘2S’]])True>>> comp10001huxxy_valid_table([[‘2C’, ‘2H’, ‘2S’, ‘2D’, ‘2S’], [‘0D’, ‘9C’, ‘8H’]])True

Order from Australian Expert Writers
Best Australian Academic Writers

QUALITY: 100% ORIGINAL PAPERNO PLAGIARISM – CUSTOM PAPER

READ ALSO  Explain or suggest how the image(s) portrayed in the advertisement contribute(s) to the IMAGE of…