Set puzzle: Difference between revisions

Content added Content deleted
m (formatting of task description)
Line 2: Line 2:
{{omit from|GUISS}}
{{omit from|GUISS}}


Set Puzzles are created with a deck of cards from the [[wp:Set (game)|Set Game™]]. The object of the puzzle is to find sets of 3 cards in a rectangle of cards that have been dealt face up. <br>
Set Puzzles are created with a deck of cards from the [[wp:Set (game)|Set Game™]]. The object of the puzzle is to find sets of 3 cards in a rectangle of cards that have been dealt face up. <br><br>
There are 81 cards in a deck.
There are 81 cards in a deck.
Each card contains a unique variation of the following four features: ''color, symbol, number and shading''.
Each card contains a unique variation of the following four features: ''color, symbol, number and shading''.


; there are three colors: '''red''', '''green''', or '''purple'''
* there are three colors:<br> &nbsp;&nbsp;&nbsp;''red, green, purple''<br><br>


; there are three symbols: '''oval''', '''squiggle''', or '''diamond'''
* there are three symbols:<br> &nbsp;&nbsp;&nbsp;''oval, squiggle, diamond''<br><br>


; there is a number of symbols on the card: '''one''', '''two''', or '''three'''
* there is a number of symbols on the card:<br> &nbsp;&nbsp;&nbsp;''one, two, three''<br><br>


; there are three shadings: '''solid''', '''open''', or '''striped'''
* there are three shadings:<br> &nbsp;&nbsp;&nbsp;''solid, open, striped''<br><br>


Three cards form a ''set'' if each feature is either the same on each card, or is different on each card. <br>
Three cards form a ''set'' 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.

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.


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'']. <br>
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.
When creating sets you may use the same card more than once.
<br><br>


;Task
;The task:
Is to write code that 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.
Write code that 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:
For instance:<br><br>


'''DEALT 9 CARDS:'''
'''DEALT 9 CARDS:'''
Line 46: Line 45:


:red, three, diamond, solid
:red, three, diamond, solid
<br>

'''CONTAINING 4 SETS:'''
'''CONTAINING 4 SETS:'''


Line 75: Line 74:


:purple, three, oval, open
:purple, three, oval, open
<br><br>


=={{header|Ada}}==
=={{header|Ada}}==