Algorithm for solving Flow Free Game

后端 未结 6 639
故里飘歌
故里飘歌 2020-12-24 02:57

I recently started playing Flow Free Game.

\"\"

Connect matching colors with pipe to creat

6条回答
  •  庸人自扰
    2020-12-24 03:34

    I found a blog post on Needlessly Complex that completely explains how to use SAT to solve this problem.

    The code is open-source as well, so you can look at it (and understand it) in action.

    I'll provide a quote from it here that describes the rules you need to implement in SAT:

    • Every cell is assigned a single color.

    • The color of every endpoint cell is known and specified.

    • Every endpoint cell has exactly one neighbor which matches its color.
    • The flow through every non-endpoint cell matches exactly one of the six direction types.
    • The neighbors of a cell specified by its direction type must match its color.
    • The neighbors of a cell not specified by its direction type must not match its color.

    Thank you @Matt Zucker for creating this!

提交回复
热议问题