CodingTrain / Wave-Function-Collapse

162 stars 59 forks source link

Why keep images in tiles graphic array? #37

Open Deg42 opened 2 years ago

Deg42 commented 2 years ago

By this time, there are duplicated tiles, one as an image and one as graphic:

  const initialTileCount = tiles.length;
  for (let i = 0; i < initialTileCount; i++) {
    let tempTiles = [];
    for (let j = 0; j < 4; j++) {
      tempTiles.push(tiles[i].rotate(j));
    }
    tempTiles = removeDuplicatedTiles(tempTiles);
    tiles = tiles.concat(tempTiles);
  }
  console.log(tiles.length);

Example: Screnshot