The SetGame class encapsulates functionality for managing and executing the rules and behavior of the game. The game involves identifying sets of three cards from a collection that satisfy specific matching conditions.
This class may include operations such as dealing cards, validating sets, and tracking the state of the game. It is designed to support the core mechanics of the "Set" game.
Deals a random selection of 12 cards from the full deck. The method shuffles the complete sequence of cards and selects the first 12 cards in the newly randomized order. HINT: use random to do the shuffling.
Deals a random selection of 12 cards from the full deck. The method shuffles the complete sequence of cards and selects the first 12 cards in the newly randomized order. HINT: use random to do the shuffling.
Identifies all possible valid sets from a given sequence of cards. A valid set consists of exactly three cards that satisfy the rules of the "Set" game: for each attribute (shape, color, number, and shading), the values must either all be the same or all be different across the three cards.
Identifies all possible valid sets from a given sequence of cards. A valid set consists of exactly three cards that satisfy the rules of the "Set" game: for each attribute (shape, color, number, and shading), the values must either all be the same or all be different across the three cards.
The method generates all possible combinations of three cards from the input sequence, evaluates each combination to check if it forms a valid set, and returns the collection of valid sets.
Value parameters
cards
A sequence of Card objects to search for valid sets.
Attributes
Returns
A sequence of valid Set objects found within the given cards.