Jump to content

Set puzzle: Difference between revisions

m
(→‎{{header|Tailspin}}: use cartesian product syntax)
Line 2,675:
</pre>
 
=={{header|Mathematica}}/{{header|Wolfram Language}}==
A simple brute force approach. This code highlights two things: 1) a few of Mathematica's "higher-level" functions such as Tuples and Subsets and 2) the straightforwardness enabled by the language's "dynamic typing" (more precisely, its symbolic semantics) and its usage of lists for everything (in this particular example, the fact that functions such as Tuples and Entropy can be used on lists with arbitrary content).
 
Line 2,692:
cards = RandomSample[allCards, numDeal];
count = Count[Subsets[cards, {3}], _?validSetQ]];
cards];
 
Row[{Style[#2, #1], #3, #4}] & @@@ deal[{9, 4}]</lang>
 
1,111

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.