Skip to content

timendum/water-color-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Water color puzzle solver

A Python script to solve the "Water color puzzle".

It takes two input:

  • a list of colors in bottles, from top (the available one) to bottom
  • a number of empty bottles

And it provides a list of moves to solve the problem.

How to run

Clone this repository and run:

python main.py

or:

uv run main.py

An example

The puzzle setup is 6 bottles, 4 with 4 colors and 2 empty:

bottle 1 bottle 2 bottle 3 bottle 4
yellow red yellow green
green red yellow yellow
green blue green red
red blue blue blue

(a vertical row is a bottle from top to bottom)

Then your input for the script will be:

yellow,green,green,red
red,red,blue,blue
yellow,yellow,green,blue
green,yellow,red,blue
(empty line)
2

The solution will be:

4->6(1green) - 1->4(1yellow) - 1->6(2green) - 2->1(2red) - 4->5(2yellow) - 3->5(2yellow) - 3->6(1green) - 2->3(2blue) - 4->1(1red) - 3->4(3blue)

So move:

  • 1 green from the 4nd bottle to the 6th bottle
  • 1 yellow from the 1st bottle to the 4th bottle
  • 2 green from the 1st bottle to the 6th bottle
  • 2 red from the 2nd bottle to the 1st bottle
  • 2 yellow from the 4nd bottle to the 5nd bottle
  • 2 yellow from the 3rd bottle to the 5nd bottle
  • 1 green from the 3rd bottle to the 6th bottle
  • 2 blue from the 2nd bottle to the 3rd bottle
  • 1 red from the 4nd bottle to the 1st bottle
  • 3 blue from the 3rd bottle to the 4nd bottle

The problem is solved.

About

Water Color puzzle game

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages