# Shape generator help (Armin Hofmann's 'rubber band' shape generator)

**URL:** <https://discourse.processing.org/t/shape-generator-help-armin-hofmanns-rubber-band-shape-generator/33190>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [October 31, 2021, 2:15pm UTC](https://discourse.processing.org/t/shape-generator-help-armin-hofmanns-rubber-band-shape-generator/33190 "2021-10-31T14:15:16Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![abk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/abk/32/12868_2.png) [@abk](https://discourse.processing.org/u/abk)\
**Post date:** [October 31, 2021, 2:15pm UTC](https://discourse.processing.org/t/shape-generator-help-armin-hofmanns-rubber-band-shape-generator/33190/1 "2021-10-31T14:15:17Z")

</div>

Hi

I’m trying to create a Hofmann’esque shape generator based on a grid of circles:

 ![hofmann_grid](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/2/2b40dd81c6ef2507913347ca6fbace6f16c1ea34.jpeg)  
 ![hofmann_grid](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/fdd6e65c097a0ec3e3b85868fe5f648d3c759a7e.jpeg)

I have the basic structure of the grid done, but I’m totally stuck on where to go from here? How do I make this into a combined shape? Here’s my code so far:

```auto
color bg = #FFFFFF;
color fc = #000000;

void setup() {
  size(800, 800);
  frameRate(2);
}

void draw() {
  background(bg);
  noStroke();

  float tilesX = 4;
  float tilesY = tilesX;
  float gap = 16;
  
  float tileW = width / tilesX;
  float tileH = height / tilesY;
  
  for (int x = 0; x < tilesX; x++) {
    for (int y = 0; y < tilesY; y++) {
    
    float posX = tileW * x - gap;
    float posY = tileH * y - gap;
    int randomSquare = floor(random(2));
    
    pushMatrix();
    
    translate(posX +(tileW/2), posY+ (tileH/2));
    
    if (randomSquare == 0) {
      fill(fc);
    } else {
      noFill();
    }
    
    ellipse(gap, gap, tileW - gap, tileH - gap);
    
    popMatrix();
    
    }
  }
  
  //noLoop();

}

```

Hope that someone can help me out and point me in the right direction 😊

---

_[View the full topic](https://discourse.processing.org/t/shape-generator-help-armin-hofmanns-rubber-band-shape-generator/33190)._
