Source of this particular implementation is not available, it’s messy, slow and not optimized, and there are still one bug I couldn’t fix.
If you want to implement WFC, I would rather suggest directly porting original source code rather than writing from scratch as I did: https://github.com/mxgmn/WaveFunctionCollapse