Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
16
Task/Set-puzzle/Mathematica/set-puzzle.math
Normal file
16
Task/Set-puzzle/Mathematica/set-puzzle.math
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
colors = {Red, Green, Purple};
|
||||
symbols = {"0", "\[TildeTilde]", "\[Diamond]"};
|
||||
numbers = {1, 2, 3};
|
||||
shadings = {"\[FilledSquare]", "\[Square]", "\[DoublePrime]"};
|
||||
|
||||
validTripleQ[l_List] := Entropy[l] != Entropy[{1, 1, 2}];
|
||||
validSetQ[cards_List] := And @@ (validTripleQ /@ Transpose[cards]);
|
||||
|
||||
allCards = Tuples[{colors, symbols, numbers, shadings}];
|
||||
|
||||
deal[{numDeal_, setNum_}] := Module[{cards, count = 0},
|
||||
While[count != setNum,
|
||||
cards = RandomSample[allCards, numDeal];
|
||||
count = Count[Subsets[cards, {3}], _?validSetQ]];
|
||||
cards];
|
||||
Row[{Style[#2, #1], #3, #4}] & @@@ deal[{9, 4}]
|
||||
Loading…
Add table
Add a link
Reference in a new issue