P5js/generative_logo_triangles/trianglegrid.js
//Check how many Neighbours are active
Check how many Neighbours are active
Check how many Neighbours are active
countActiveNeighbours() {
      this.activecount=0;
      for (let i = 0; i < 3; i++) {
        if (this.neighbours[i] && this.neighbours[i].active) {
          this.activecount++;
        }
      }
      return this.activecount;
    }
countActiveNeighbours ( ) { this . activecount = 0 ; for ( let i = 0 ; i < 3 ; i ++ ) { if ( this . neighbours [ i ] && this . neighbours [ i ] . active ) { this . activecount ++ ; } } return this . activecount ; }
Check how many Neighbours are active
Check how many Neighbours are active
// returns number of active neighbours