Code Monkey home page Code Monkey logo

java-wfc's Introduction

jwfc (java-wfc)

An abstract java implementation of the wave function collapse (wfc) algorithm.

It is specifically designed with the simple tiled version of the algorithm in mind.

Currently the project is work in progress and more of a proof of concept type of thing.

Installation

For now, there are no prebuilt jar files available, so you will have to clone (or download) this repository and build and artifact yourself locally. Then add it as a jar dependency to your project.

The project requires Java version 8.

Open TODO:

I'm currently in the process of understanding and setting up a maven repository through GitHub Packages. I'll convert the project to a maven project (https://www.jetbrains.com/help/idea/convert-a-regular-project-into-a-maven-project.html) and then set up the public repository package (https://help.github.com/en/github/managing-packages-with-github-packages/configuring-apache-maven-for-use-with-github-packages).

This might take a while for me to do, as I'm working full time.

Example:

(This assumes an IntelliJ IDEA artifact build was configured and used to generate a jar file in the default location). Feel free to experiment with different map dimensions and types inside the TileMapTest class.

java -jar out/artifacts/java_wfc_jar/java-wfc.jar
:: input (width=5, height=5)
0  0  0  0  0  
0  1  1  1  0  
0  1  2  1  0  
0  1  1  1  0  
0  0  0  0  0  
:: output (width=10, height=10, periodic=false)
0  0  0  0  0  0  0  0  0  1  
0  1  1  0  0  0  0  0  1  0  
1  1  0  1  0  0  0  0  0  0  
0  1  0  1  1  1  1  0  1  1  
0  0  0  0  0  0  0  0  0  0  
0  1  1  0  0  0  0  0  0  0  
0  1  1  0  0  0  0  1  0  0  
1  0  1  1  0  1  1  0  0  0  
0  1  0  1  1  1  0  0  0  1  
1  0  0  1  2  1  0  0  0  0  
:: output (width=10, height=10, periodic=true)
0  1  0  0  1  0  0  0  0  0  
0  0  1  1  0  0  0  0  1  1  
0  1  2  1  1  1  0  1  1  1  
1  0  1  0  0  0  0  0  0  1  
0  0  0  0  0  0  1  0  0  0  
0  0  0  1  1  0  0  0  1  0  
0  1  0  1  0  0  0  0  0  0  
0  0  0  0  0  0  0  0  1  0  
1  0  1  0  0  0  0  1  0  0  
1  1  0  0  1  0  0  0  1  0  

I ran the test multiple times to get a result where both maps contain all possible numbers (tiles), as the 2 has a very low weight (of 1) compared to the 1 (with a weight of 8) and the 0 (having a weight of 16) in the input map.

The Algorithm

You can find the original algorithm here (written in C#).

License

It's MIT.

java-wfc's People

Contributors

gameplayjdk avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

java-wfc's Issues

wafe -> wave

The repo tagline and the readme refer to "wafe" function collapse -- I think you mean wave function collapse?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.