Source |
Mathematica source code:
ladders = ((1, 38}, {4, 14}, {9, 31}, {21, 42}, {28, 84}, {36, 44}, {51, 67}, {71, 91}, {80, 100));
snakes = ((16, 6}, {47, 26}, {49, 11}, {56, 53}, {62, 19}, {64, 60}, {87, 24}, {93, 73}, {95, 75}, {98, 78));
maxNum = 100;
numDieSides = 6;
f := If[0 <= #2 - #1 <= numDieSides, If[#1 != #2, 1/numDieSides, If[#1 + numDieSides <= maxNum, 0, (numDieSides + #1 - maxNum)/numDieSides]], 0] &;
p = Table[f[i, j], {i, 0, 100}, {j, 0, 100}];
pTranspose = Transpose[p];
transports = Union[snakes, ladders];
For[i = 1, i <= Length[transports], i++, pTranspose[[transports[[i, 2]] + 1]] = pTranspose[[transports[[i, 1]] + 1]] + pTranspose[[transports[[i, 2]] + 1]]]
For[i = Length[transports], i > 0, i--, pTranspose = Delete[pTranspose, transports[[i, 1]] + 1]]
p = Transpose[pTranspose];
For[i = Length[transports], i > 0, i--, p = Delete[p, transports[[i, 1]] + 1]]
points = ((0, 0));
pPower = IdentityMatrix[Length[p]];
For[x = 0, x <= 250, x++, points = Union[points, ((x, (pPower = pPower.p)[[1, Length[p]]]))]]
ListPlot[points, Joined -> True, Frame -> True, PlotRange -> ((0, 250}, {0, 1)), ImageSize -> 500]
After saving the image as an SVG from Mathematica, edit the raw SVG text by adding "width='500' height='312'" to the end of the SVG tag. |