I am trying to fill a 2d-array randomly with 0s and 1s. The condition is that each 1 has to be 'placed' right next to another 1 either vertically or horizontally, but not diagonally.
http://ift.tt/1Q0VY2N On the screenshot you see 3 blocks of 1s. I want them to be 'connected' so that there is only one block of 1s.
Is there any algorithm or something to do that?
Aucun commentaire:
Enregistrer un commentaire