Skip to content
/ wfc Public

The Wave Function Algorithm, written in Rust.

Notifications You must be signed in to change notification settings

aflaag/wfc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

wfc

An implementation of the Wave Function Collapse algorithm in 2D.

Example

The following exmaple was generated while using the MazeTile tile that can be found inside tile.rs.

╋┫ ┏┓┃┃┣╋━┛┃ ┗┓┗┫┣━┛┗┛┣┫ ┃  ┃┣━┓┣┫┗┫┃┗╋┛ ┃  ┃┃┏┻┛┏┻┫ ┣┫┏╋┓┃┃┗┓ ┃┣┻┓┏━┓┏┻┓ ┣┫┣┻━╋
┣╋━┛┃┗┛┣┫  ┃  ┣━┫┗┓┏┓ ┃┃ ┣┓ ┃┣━┛┗┛ ┣╋┓┣┳┓┣┓┏┫┗┻┓ ┣━┻━┫┃┗┻╋┛┃ ┃ ┣┫┏┫┃ ┃┗┓┗━┻┫┃  ┃
┛┃┏┳┫  ┃┣┓┏┫┏┳╋┓┣┳┻┻┛ ┣╋━┫┗┓┗╋━┓┏━┳╋┛┗╋╋┛┗╋╋╋━━┛┏┫┏┳━┫┃┏┓┣━┻┓┣┓┃┗┫┃┣━┻┓┗━━┳╋┫  ┣
━┛┗┫┣┓┏┫┣┻┻┛┗┛┗┫┃┃    ┃┃ ┣┓┣━╋━┛┗┳┛┃  ┣┫┏┳┻┫┗━┓┏┻┻┛┣┓┃┃┗╋┛  ┃┗┻╋┓┣┻┛  ┣┳━┓┣┻┛  ┃
  ┏┻┫┗┫┗┻━┓    ┣┫┣┳┳┳┳┛┃ ┣┻┛ ┃┏━┳┻━┫  ┣╋┫┃ ┃  ┣┫┏┳┳┻╋┛┃ ┃   ┃  ┣╋┛    ┣╋┓┣┻┳━┳┳┛
  ┣┓┃ ┗┳┓┏╋━━┓ ┣╋┫┃┃┗┻┓┣━┻┳┓┏╋┛ ┣┳┳┛  ┃┣┻┫┏┫  ┃┗┫┗┻┳┛ ┣━╋━━━╋┳┳┛┃┏━┓┏┳╋┫┗┛ ┃┏┛┃ 
┏┳┻┛┣┳┓┃┃┣┛┏━┛┏┫┃┣╋╋┳┳┫┃┏┓┣╋┛┗┓ ┣┻┻┳━━╋╋┓┗┛┣┓ ┣┓┣━┓┃  ┣━╋┓  ┣┫┗┓┃┗┳╋┛┃┣╋━┓┏┻╋┓┗┓
┻╋┳━┫┗┻┫┗╋━┫┏┳╋╋╋┫┣┫┗┛┗┻╋┛┣┻┳━┻━┫  ┃┏┳┫┗╋━━┻┫ ┃┣┫ ┃┗┳━┻━┛┣┓┏╋┫ ┣┻━┫┣━┛┗╋━┛┣┳┻┛ ┣
┳╋┻┳╋━┳┫ ┃ ┣┻┫┗╋┫┃┗┛    ┣━┻━┻┳━┳┛┏━╋╋╋┫ ┃   ┣━┻┻┛ ┣┓┗━┳━┳┛┃┣┫┃ ┣━┳┛┃┏┓ ┣┳━┛┣┓  ┣
┫┣┓┃┗┳┻┫ ┣┳╋┳╋┳┫┗╋┳━┓   ┣┳┓┏━┫ ┣┳┫ ┣┫┃┃ ┃┏┳┓┃┏┓┏┓ ┃┣━┓┗┳┫ ┃┣┫┃┏┫┏┫ ┃┗┻┓┃┗┳┓┣┻━┳┛
┫┣╋┻┓┣┓┗┓┗┫┃┗┫┗╋━╋┫ ┃┏┳━┻┫┗┫ ┣┳┛┃┣┳┻┻┻╋━┫┃┃┣┫┗╋┫┗┓┣┫┏╋┳╋┫ ┃┣╋╋┛┃┣┻┓┗━┓┃┣┓┃┣┻┳┓┗━
┗┫┗┓┗╋╋┳╋━┻┫┏┻━┫ ┃┃┏┫┃┣┓┏┻┓┃ ┃┣┳┻┛┗┳┳━┻━╋┛┗╋┛┏╋╋━╋╋┛┃┣╋╋┫┏┫┗╋┫ ┃┗┓┗━┳╋┛┗┫┣┻┓┃┗━┳
┓┣┳┛┏╋┫┃┣━━┻┻┳┳╋┳┛┣┫┗╋┫┗┻┳┻┻┓┣╋┛   ┃┗┳┓┏┛┏━┛ ┣┫┗━┛┃ ┃┃┃┣╋┛┣┓┃┗┓┣━┫┏┳┛┣┓┏┫┃ ┣╋┳━╋
┫┗┛┏┛┗┫┣╋┳┳┳━┛┃┣┻┳┛┃┏┫┃  ┣┳┓┃┗┛┏━┳┳╋━┛┗╋━╋━━┓┗┛   ┣━╋┫┃┃┣━┫┣┻━╋╋━┫┣┻━┛┃┗╋┫┏┛┃┗┳┛
┫  ┗┓┏┫┣┻┻┛┗┳┳╋┫ ┗┳┻┻╋╋━━┻┫┗┻━┳┫┏╋╋╋━┳━┫ ┃┏━┻━━┳┳┓┣━┻┫┣╋┛ ┣╋━┳┫┗┓┃┣━┓ ┣┓┗┻┫┏┻━┻┓
┃ ┏━┛┃┃┃    ┗┻╋┫ ┏┛  ┣╋┳┓ ┣┳━┓┣╋┛┃┣┻┳┻┓┃┏┻┻━━┓┏╋┛┃┃┏━╋┫┣┓┏╋╋━┫┣┳┛┃┗┳╋┳┻╋━━┫┃   ┣
┣┳╋━┓┗┛┃    ┏━┫┃ ┣━┳┳┻┛┗┛ ┣╋┓┗┻┻┳┛┣┳┫┏┻╋┫    ┃┗┫ ┣╋╋━┫┗┫┗┻┫┗┳╋┫┗┓┗┳╋╋┛┏╋┓ ┣┫   ┣
┗╋┫ ┃  ┃    ┣┓┗╋┓┣┓┣┫     ┃┣┫┏┳━┛ ┣╋┛┃┏╋┛┏┳┓┏┛ ┣┳╋╋┛ ┃ ┣┓┏┫ ┣╋╋┓┗┳╋╋╋━┻╋┫┏┛┗━┳┓┗
┓┃┣┓┃  ┃    ┃┃┏╋╋╋╋┛┃     ┃┣┻┻╋┓┏┓┃┣┓┃┗┛┏╋┛┗┫┏━┻┛┃┗┓ ┃ ┃┗┻╋┳┻┻┫┃┏╋╋┫┣┳━╋┫┗━┳┳┛┗━
┗╋╋╋┛┏━┫ ┏━┳┻╋┻┫┃┃┣━┛     ┣┻┓┏╋╋┛┗┻┛┣┫  ┃┣┳┳┛┣┳┓┏┻┳┫ ┃ ┣┓ ┃┃  ┣╋┛┃┗┫┃┣┳╋╋┳┳┫┗┳┳┓
┳┫┗┫ ┃┏┻━╋━┛┏╋┓┃┃┗┛┏┓     ┣┳╋╋╋┛┏━━┓┃┃  ┃┃┃┃ ┣┫┣╋┓┃┃ ┃┏╋╋━┻┫┏┳┛┗┓┗┳╋┛┃┣┻┫┗┛┣━┻╋╋
┫┃┏┻┓┗┫ ┏┫  ┣┛┣┻┫  ┣┫     ┣┻┻┻┻┳┻┳┳┫┃┃┏┓┗┻┻┻━╋┛┣┫┗┛┃┏╋┫┃┣┓┏┛┗┛┏┳┻┓┗┫ ┃┗━╋━┓┃  ┃┗
┛┗┛┏┻┓┗━┛┗━┓┃ ┗┓┗┳┓┃┃┏━┓  ┃┏━┳┓┃ ┣╋┛┃┗┻╋┓┏┳┓┏┻┳╋┫┏┳┛┗╋┛┣╋┛┗┓┏┳┛┗┓┣━┻┳┫┏━┛┏┫┣┓┏┻┳
  ┏┫ ┃     ┗┛┏┳╋━╋┛┣┻╋┳┛  ┃┗┓┃┣╋┓┃┗┓┃  ┣┫┣┻┫┃┏╋┫┣╋╋┓┏╋━╋┫  ┃┣┫┏┓┃┃  ┃┃┗┓┏┻┛┃┣┫ ┃
┏┓┗┛┏┫       ┗┫┗┓┗┳╋┓┃┗━┳┓┗┳╋┫┣╋╋╋┳┫┣┳━┫┣╋━┻┛┗┫┃┃┗┻╋┛┣┳┫┣┓ ┃┃┃┃┗┻╋━┳┛┃ ┃┃┏┳┻┫┃ ┣
┣┻┳┓┗┫        ┃ ┃┏┻┛┗┫  ┃┣┳┫┣╋┛┗╋┫┣┫┗┻┓┗╋╋┳┳┳━╋┛┣┓ ┣┳╋╋┛┣┻┳┛┃┗┫  ┃┏┛┏╋━┛┗╋┛┏┫┃┏┻
┻┓┗┫┏┛┏┓      ┃┏┛┃   ┣━━┫┣┫┣┫┗┓┏╋╋╋┛  ┣━┻┛┃┗┛ ┃ ┃┗┳┛┣┫┃ ┃ ┣┳┫ ┣━┓┗┫┏╋╋┓┏┓┗━┛┗┻┻┳
 ┗━┻┫ ┃┃    ┏━╋╋━╋━┓┏┻━┳┛┃┃┃┗┓┗┛┃┣┫┏┳┓┣┳┳━┛┏━┳┛┏┫ ┃┏┛┣┫ ┣┳╋┛┗┳┻┳┻┳╋┛┃┣┫┃┗┳━┳┓┏┳┫
┓┏┓┏╋┓┗┻━┓┏━╋┳╋┻━╋┓┗┫  ┃┏╋┛┗┓┃  ┣┻┫┗╋┛┣╋╋┓┏┛ ┃ ┣┻┓┃┗┳┻┫ ┣╋╋━┓┃ ┣━╋┫ ┣┫┣┻━┛┏┫┣┫┗┫
┃┃┗┛┗┫   ┗┻━┻┻╋┓┏┫┃ ┃┏┓┃┗┻┓┏┛┣┳━┻┳╋━┫┏╋╋┛┗┫┏┓┃┏╋━┫┃ ┃ ┣━┫┃┃ ┃┣┓┃ ┃┗━╋┫┣┳━┳┛┗┻┛┏╋
┃┃   ┃    ┏┳━━┻┛┗╋╋┳┫┃┣╋┓┏┛┗━╋┛  ┣┻━┫┃┗┫  ┃┣╋╋┫┗┓┃┗┳┻┓┗┳┫┗┛┏╋┛┃┃ ┣┓ ┣┻┻┻━┻┳━┓┏┫┗
┛┣━┳┓┣┓   ┣┻┓┏┳┳━┛┃┗╋┫┗╋┫┗┳━┓┗┳┳┓┃  ┃┃ ┣━┳┛┃┗┻╋━┻┻┓┗┓┣┳┻┻━┓┃┗┓┃┃┏┛┣┳┛     ┃┏╋┫┃┏
┏╋┳╋┫┃┣┳━┳┻┓┣┫┃┃  ┣━┛┃ ┣┛┏┫ ┃┏┛┃┗╋━━┫┗┓┗━┛┏┛┏┳┻┓┏┓┃ ┣╋┫   ┃┃┏┻╋╋╋┓┃┣┓┏┓   ┣┫┣┫┣┫
┛┃┣┛┃┃┣┻┓┣━┛┗┫┃┣┳┓┃  ┗━┻┓┗┻━┫┣┳╋┓┗┓┏┻┓┗┳┓┏┛┏┫┗━╋┛┃┗┓┗┻╋┳┓┏┫┃┣━┻╋┫┣╋╋┫┣┻┳┳┓┗┻┫┗╋╋
 ┗╋┓┣┫┃ ┗┻┳━┳┫┗┛┃┗┫   ┏┓┃┏━━┛┗┫┣╋━┻┫┏┛ ┃┗╋━┻┻━┳┫┏┛┏┫┏┓┃┃┗┛┗┫┗┓ ┃┗┻╋╋┫┗┓┗╋╋┓ ┃┏╋╋
 ┏╋┫┗╋┫┏┳┓┣┳┫┃  ┣┓┣┓┏┓┃┃┃┃    ┗┫┣┳┳╋┛┏┓┗┓┃    ┣┻┻┳┻┛┣┫┣┻━━━┛┏┛┏╋┓┏┻╋┛ ┃ ┣╋╋━┛┣┻┫
┳╋┻┫┏┻┫┗┫┃┣╋┫┣━┳┻┛┣┫┗┛┣┫┗┫    ┏┛┣╋┛┣┓┃┣┓┗┫    ┃  ┗┳┓┣┛┣━━┳┳━┛┏┛┗┫┃ ┃  ┃┏┻┛┃  ┣┳┻
┃┃ ┣╋━┻┓┣┛┣┻┫┗┓┃ ┏┫┃  ┣╋┓┃┏━━┳┫ ┃┃ ┣┫┣╋┻┓┣┳━┳━┛   ┣┫┗━┻━━┛┗┓┏┛  ┃┃┏╋┓ ┣╋┓┏┛  ┣┻┳
┻┛┏┛┣┳┓┃┗━┻━┻┓┣┫┏┛┃┃  ┗┛┃┗╋┳┳┫┗┓┗╋┳╋┫┃┃ ┣┫┗┳┫     ┃┃       ┃┣┓  ┃┃┗┻┛┏┻╋╋┛┏┳┓┣┓┃
┓ ┣┓┃┃┣╋┳┓┏┓┏┻╋┛┗━┛┗┓   ┣┓┣┫┗┛ ┣━┻┻╋┫┣┻━┫┣┳┫┣━┓┏━┳╋╋━┓┏━┳┳━╋┫┗━┓┃┣┳┓┏┛┏╋╋┳┛┃┗╋┫┃

About

The Wave Function Algorithm, written in Rust.

Topics

Resources

Stars

Watchers

Forks

Languages