Dominoes: Difference between revisions

Line 257:
sols = {};
ClearAll[RecursePlaceDomino];
RecursePlaceDomino[placed_List, left_List] := Module[{newplaced, sortedleft, newleft, next},
Module[{newplaced, sortedleft, newleft, next},
If[Length[left] == 0,
AppendTo[sols, placed];
Line 280 ⟶ 279:
sols[[All, All, 2]] = sols[[All, All, 2]] /. possshorti;
sols
]
 
 
tab = {{6, 2, 1, 0, 4, 0, 0}, {4, 1, 1, 6, 3, 5, 5}, {5, 4, 3, 2, 0,
Line 294 ⟶ 292:
sols = FindSolutions[tab];
Length[sols]
VisualizeState[sols[[1]], tab]</lang>
{{out}}
 
<pre>1
 
[Graphical output of the solution]
2025
[Graphical output of the first solution]</pre>
 
===Extra credit task ===
<lang Mathematica>ClearAll[DominoTilingCount]
DominoTilingCount[m_, n_] := Module[{},
Round[Product[
4 Cos[(Pi j)/(m + 1)]^2 + 4 Cos[(Pi k)/(n + 1)]^2, {j,
Ceiling[m/2]}, {kj, Ceiling[nm/2]}]],
{k, Ceiling[n/2]}
]]
]
arrangements = DominoTilingCount[7, 8] // Round;
permutations = 28!;
Line 313 ⟶ 317:
Print["Possible permuted arrangements with flips: ", flips*arrangements*permutations]</lang>
{{out}}
<pre>Arrangements ignoring values: 1292697
<pre>
1
[Graphical output of the solution]
2025
[Graphical output of the first solution]
 
Arrangements ignoring values: 1292697
Permutations of 28 dominos: 304888344611713860501504000000
Permuted arrangements ignoring flipping dominos: 394128248414528672328712716288000000
1,111

edits