Skip to content

Using SAT solvers to generate solutions for Flow levels.

Notifications You must be signed in to change notification settings

lacop/FlowSolver

Repository files navigation

FlowSolver

Using SAT solvers to generate solutions for Flow levels. Can solve selected level on device automatically using MonkeyRunner.

www.youtube.com/watch?v=NxKmFT4qsQM

The code is quite messy and slow, but it works.

Example run

For a fully autonomous solving of a level on screen run

python solve_monkey.py

This will perform the following steps:

  • Use MonkeyRunner to take a screenshot.
  • Extract the level from the screenshot.
  • Setup SAT clauses and write them to file.
  • Run a SAT solver on the file to generate a solution.
  • Display the solution.
  • Finally, use MonkeyRunner to send a series of drag events to execute the solution on the device.

solution

Old examples

These are old examples using MiniSAT. By using glucose you can achieve much better speeds.

level_8_150

Level 8x8, #150 2,688 variables, 58,603 clauses, solved instantaneously

level_14_1

Level 14x14, #1 20,580 variables, 1,095,960 clauses, approx. 3 minutes to solve

level_14_30

Level 14x14, #30, with cycle breaking 59,388 variables, 12,256,516 clauses, approx. 4 minutes to solve

level_14_30

Level 14x14, #30, without cycle breaking 20,580 variables, 1,096,306 clauses, approx. 1 minutes to solve

About

Using SAT solvers to generate solutions for Flow levels.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages