Giter Site home page Giter Site logo

water_sort_puzzle_solver's Introduction

| English | 简体中文 |

Water Sort Puzzle Solver

A visible solver to water sort puzzle base on python.

To get this game: App Store | Google Play

Game:

level107

Solver:

solver1

... ...

solver2

Quick Start

Binder

Click HERE and wait for 1 minute to get into an online environment for free!

After get into this ↑ environment, you need to Shift + Enter to execute this block first to install matplotlib

install

Then use Shift + Enter to execute this block to get the Solver's result

execute

Finally you can get the results!

result

More Details

We define the state of current by these Label of colors:

colors-1

Then you can define a status like this:

bottle_state = [
    [PU,YE,PI,PI],
    [PU,YE,PU,YE],
    [PI,PU,YE,PI],
    [],
    [],
]

Then let the Solver to give you the solutions:

solve_puzzle(bottle_state)

You can customize the process and outputs by rewriting this function:

Or if you can ignore this if you don't understand it

def solve_puzzle(bottle_state):

    pvb = PlotableVialBoard(bottle_state)  # Initialize
    solved_pvb = solve(pvb)  # Solve puzzle
    paths = solved_pvb.path  # Save Solution

    # Print out Solution:
    new_pvb = pvb.clone()

    print('Origin Status:')
    new_pvb.show()

    for n, path in enumerate(paths):
        print('Step %d: %d --> %d' % (n+1, path[0]+1, path[1]+1))
        new_pvb.move(*path)
        new_pvb.show()
        print()

Use on Native Mechines

Download:

git clone https://github.com/wjfjfm/water_sort_puzzle.git

Install jupyter notebook (Skip this if you already installed):

pip install jupyter

Use jupyter notebook to to open this page

cd water_sort_puzzle && jupyter notebook water-sort-puzzle-solver.ipynb

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.