CodingTrain / CodingTrain/Wave-Function-Collapse

Optimize grid updates

オープン
#41 コメント 0 件 リアクション 2 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
218
フォーク
64
PR マージ指標
30日以内にマージされた PR はありません

説明

Hey, thank you very much for all your videos, I'm having a blast watching them!

I made a Pull Request [here](https://github.com/CodingTrain/Wave-Function-Collapse/pull/40) to make grid updates more efficient. Instead of watching all cells one by one hoping that there might be some change, we can start from a modified cell (i.e. options are reduced for this cell), and update the neighbours. For each neighbour that has fewer options than before, we continue and check its neighbours etc.
We stop when no update is possible anymore, and the system is stable.

The idea comes from Constraint Programming, where constraint propagation is a thing that can be done this way. Here the constraints handle the compatibility between adjacent cells, and when a cell changes (its options are reduced), it triggers the consistency check of attached constraints.

The next step will be to collapse a new cell, and check its neighbours etc.

This allows to solve much larger instances, since it doesn't consider untouched cells. Here with 100x100 cells for instance:
![wfc-100-1](https://user-images.githubusercontent.com/6671307/180328561-f9e4ff05-3de8-44ed-82b9-8aec069605f5.gif)

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。