@@ -202,7 +202,8 @@ export class CCA3D {
202
202
this . state [ z ] [ y ] = [ ]
203
203
this . bufferState [ z ] [ y ] = [ ]
204
204
for ( let x = 0 ; x < this . cubeDimension ; x ++ ) {
205
- const randomColor = this . colors [ Math . floor ( Math . random ( ) * this . colors . length ) ]
205
+ const randomColor =
206
+ this . colors [ Math . floor ( Math . random ( ) * this . colors . length ) ]
206
207
const cell = this . createCell ( randomColor , x , y , z , false )
207
208
this . state [ z ] [ y ] [ x ] = cell
208
209
// Initialize buffer with same properties but without mesh
@@ -283,16 +284,16 @@ export class CCA3D {
283
284
const currentCell = this . state [ z ] [ y ] [ x ]
284
285
const nextColorId = nextCellColorId ( currentCell , this . colors )
285
286
const successorNeighboursCount = this . getNeighbours ( x , y , z ) . filter (
286
- ( neighbour ) => neighbour . id === nextColorId
287
+ ( neighbour ) => neighbour . id === nextColorId ,
287
288
) . length
288
289
289
290
if ( successorNeighboursCount >= this . threshold ) {
290
291
const newColor = this . colorMap . get ( nextColorId ) ?? currentCell
291
-
292
+
292
293
// Update the buffer state
293
294
this . bufferState [ z ] [ y ] [ x ] = {
294
295
...newColor ,
295
- mesh : currentCell . mesh
296
+ mesh : currentCell . mesh ,
296
297
}
297
298
298
299
// Update the visual if color changed
@@ -307,9 +308,8 @@ export class CCA3D {
307
308
}
308
309
}
309
310
}
310
-
311
311
// Swap buffers
312
- [ this . state , this . bufferState ] = [ this . bufferState , this . state ]
312
+ ; [ this . state , this . bufferState ] = [ this . bufferState , this . state ]
313
313
}
314
314
315
315
private getNeighbours ( x : number , y : number , z : number ) : Cell [ ] {
0 commit comments