Hello community.
I am exploring a simulation of points that randomly escape from a region using Manipulate[], but I feel that something is not right...
Apparently, there are no errors (error messages), but I think there is something in the code that I don't understand how to make it work better... maybe I did it in a more complicated way than I should have.. or it's something else that I didn't know how to use properly. For example, I was only able to make the code work the way I wanted using two Manipulate[], and that doesn't seem the best way.
I will be very grateful if someone can take a look and maybe help me make the code cleaner or show me the best use of some commands I used here.
Thanks in advance.
Manipulate[
z = Table[SeedRandom[(i + seed)^3 // ToString];
a = RandomReal[{0.001, 0.999}, points];
b = RandomReal[{0.001 + i*0.002, 2.236 + i*0.05}, points];
c = Thread[{a, b}], {i, 0, 150}];
zz = Table[Table[z[[x, y]], {x, 1, 151}], {y, 1, points}];
Manipulate[
ll = Subsets[
Table[Table[zz[[g1, zf]], {zf, 1, 151}][[time]], {g1, 1,
points}], {2}];
Show@Join[{Graphics[{Line[{{0, 0}, {0, 8}}]}]}, {Graphics[{Line[{{1,
0}, {1, 8}}]}]}, {Graphics[{Line[{{0, 0}, {1,
0}}]}]}, {Graphics[{Dashed, Gray, Circle[{0.5, 1}, 8]}]},
Table[Table[
Graphics[{Hue[SeedRandom[g2 // ToString]; RandomReal[]],
EdgeForm[Black], Disk[zz[[g2, zd]], 0.1]}], {zd, 1, 151}][[
time]], {g2, 1, points}]],
Dynamic[Show@
Join[{Graphics[{Line[{{0, 0}, {0, 8}}]}]}, {Graphics[{Line[{{1,
0}, {1, 8}}]}]}, {Graphics[{Line[{{0, 0}, {1,
0}}]}]}, {Graphics[{Dashed, Gray, Circle[{0.5, 1}, 8]}]},
Table[Table[
Graphics[{Hue[SeedRandom[g3 // ToString]; RandomReal[]],
Line[{zz[[g3, zc]], zz[[g3, zc + 1]]}]}], {zc, 1,
time}], {g3, 1, points}]]], Dynamic[{"time", time}],
Dynamic[{"points", points}], Dynamic[{"seed", seed}],
Dynamic[Thread[{{"Max", "Min"},
Map[#@Table[
N@EuclideanDistance[Subsets[ll, {2}][[r, 1]],
Subsets[ll, {2}][[r, 2]]], {r, 1,
Length@Subsets[ll, {2}]}] &, {Max, Min}]}]]], {time, 2, 150,
10}, {points, 1, 10, 1}, {seed, Range@30}]