# Simplify interactive point manipulation?

**URL:** <https://community.wolfram.com/t/simplify-interactive-point-manipulation/15605>\
**Category:** Questions\
**Tags:** graphics-and-visualization, interface-construction\
**Created:** [March 27, 2020, 3:53pm UTC](https://community.wolfram.com/t/simplify-interactive-point-manipulation/15605 "2020-03-27T15:53:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![quimicalobo](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/quimicalobo/32/8777_2.png) [@quimicalobo](https://community.wolfram.com/u/quimicalobo)\
**Post date:** [March 27, 2020, 3:53pm UTC](https://community.wolfram.com/t/simplify-interactive-point-manipulation/15605/1 "2020-03-27T15:53:48Z")

</div>

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}]

```

 ![2939i1.png](https://global.discourse-cdn.com/wolfram/original/3X/c/c/cc4ceb1ec82556f524f20ff054a0a82201e626dd.png)
