Set puzzle: Difference between revisions

m
dealing from a shuffled deck is random enough
(Task clarification based on update to Python code.)
m (dealing from a shuffled deck is random enough)
Line 13:
Three cards form a <u>set</u> if each feature is either the same on each card, or is different on each card. For instance: all 3 cards are red, all 3 cards have a different symbol, all 3 cards have a different number of symbols, all 3 cards are striped.
 
There are two degrees of difficulty: [http://www.setgame.com/set/rules_basic.htm ''basic''] and [http://www.setgame.com/set/rules_advanced.htm ''advanced'']. The basic mode deals 9 cards, that contain exactly 4 sets; the advanced mode deals 12 cards that contain exactly 6 sets. When creating sets you may use the same card more than once. The task is to write code that randomly deals the cards (9 or 12, depending on selected mode) from a shuffled deck in which the total number of sets that could be found is 4 (or 6, respectively); and print the contents of the cards and the sets. For instance:
 
 
Line 465:
if __name__ == '__main__':
while( True):
deal = getdeal()
sets = getsets(deal)
Anonymous user