mxgmn / WaveFunctionCollapse

Bitmap & tilemap generation from a single example with the help of ideas from quantum mechanics
Other
23.05k stars 1.23k forks source link

Please comment the code! #78

Open 10maurycy10 opened 1 year ago

10maurycy10 commented 1 year ago

Comments make reading and debugging the code much easier.

They are especially necessary if the code has one letter variable names!

mxgmn commented 1 year ago

I agree. Will add a few comments when I have time. Right now I can say that in SimpleTiledModel.cs a is a 90 degrees rotation, and b is tile reflection.

segrallx commented 1 year ago

hello,what's the meaning of symmetry?
cardinality ? func a b ?

need some comments. thanks.. or is any place we can talk about wfc . maybe anybody need some help or communicate.

appgurueu commented 1 year ago

hello,what's the meaning of symmetry?

Google it.

cardinality ?

Google it.

Comments are not the place for defining basic mathematical terms.

segrallx commented 1 year ago

thank you , i still consued about the meaning of X ,F, L ,T could you tell me what symmetry they are representing?

mxgmn commented 1 year ago

X, F, L, T are types of tile symmetries. X means a fully symmetric tile: you can rotate it 90, 180, 270 degrees or reflect it, and it would still look the same (like letter X). L can be reflected along the line y=x. F has no nontrivial symmetries.

ldo commented 1 year ago

Cardinality: how many orientations (excluding reflection) of a tile with this symmetry can be distinguished.

Func<int, int> a, b: I call a the rotate_func — the function that transforms the index of a tile orientation to the one for the next 90° rotation anticlockwise — and b the reflect_func — the function that transforms the index of a tile orientation to the one for the reflected version.

Also worth pointing out that all the quantum mumbo-jumbo is a complete red herring. If you want a physical analogy, use the term “phase change”.