# Mitosis chain reaction, cant get it under control

**URL:** <https://discourse.processing.org/t/mitosis-chain-reaction-cant-get-it-under-control/16937>\
**Category:** Coding Questions\
**Created:** [January 7, 2020, 5:37pm UTC](https://discourse.processing.org/t/mitosis-chain-reaction-cant-get-it-under-control/16937 "2020-01-07T17:37:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZenVega](https://avatars.discourse-cdn.com/v4/letter/z/7ba0ec/32.png) [@ZenVega](https://discourse.processing.org/u/ZenVega)\
**Post date:** [January 7, 2020, 5:37pm UTC](https://discourse.processing.org/t/mitosis-chain-reaction-cant-get-it-under-control/16937/1 "2020-01-07T17:37:28Z")

</div>

Hey all,  
so i created this advanced version of the mitosis simulation challange (‘[https://thecodingtrain.com/CodingChallenges/006-mitosis-p5.html](https://thecodingtrain.com/CodingChallenges/006-mitosis-p5.html)’) and among others included a function to remerge the cells. It kinda works but in most cases one remerch causes a chain reaction which merges all the cells in the canvas. I tried for hours solving this. can anybody help??

plus i created it in my brother wis an html file. now that i pasted it in the editor i realised it has a lot of issues showing the objects without flickering.

[https://editor.p5js.org/ZenVega/present/sF40draFv](https://editor.p5js.org/ZenVega/present/sF40draFv)

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [January 8, 2020, 1:42am UTC](https://discourse.processing.org/t/mitosis-chain-reaction-cant-get-it-under-control/16937/2 "2020-01-08T01:42:15Z")

</div>

please format your code posting by pasting it into the

```auto
</> code button

```

of the editor header menu ( context name: Preformatted text )  
it looks like  
```  
type or paste code here  
```

also can use the ``` manually above and below your code.

thank you.

* * *

here in case of a p5.js project,  
better not post code, just the link to the  
[https://editor.p5js.org](https://editor.p5js.org)  
project in the online editor

* * *

also please edit your title so it not uses profane language  
or your whole post might get flagged.

---

<div class="post-metadata">

**Author:** ![ZenVega](https://avatars.discourse-cdn.com/v4/letter/z/7ba0ec/32.png) [@ZenVega](https://discourse.processing.org/u/ZenVega)\
**Post date:** [January 8, 2020, 6:38am UTC](https://discourse.processing.org/t/mitosis-chain-reaction-cant-get-it-under-control/16937/3 "2020-01-08T06:38:07Z")

</div>

Done that, thanks for the advice
