kellerb / voltorb-flip

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prerequisites

pip3 install attrs
pip3 install z3-solver

Use

$ python3 voltorb-flip.py
Enter col constraints left-to-right, then row constraints top-to-bottom as repeated "{sum} {voltorb count}"
5 0 6 1 4 2 6 1 3 2 6 1 3 2 6 0 6 1 3 2
Enter cell constraints as repeated "{row} {col} {val}"

num_soln 174
{1: 1.0}                              {0: 0.098, 1: 0.29, 2: 0.39, 3: 0.23} {0: 0.34, 1: 0.34, 2: 0.31}           {0: 0.098, 1: 0.29, 2: 0.39, 3: 0.23} {0: 0.46, 1: 0.54}
{1: 1.0}                              {0: 0.4, 1: 0.6}                      {0: 0.66, 1: 0.34}                    {0: 0.4, 1: 0.6}                      {0: 0.54, 1: 0.46}
{1: 1.0}                              {1: 0.69, 2: 0.31}                    {1: 0.62, 2: 0.38}                    {1: 0.69, 2: 0.31}                    {1: 1.0}
{1: 1.0}                              {0: 0.098, 1: 0.29, 2: 0.39, 3: 0.23} {0: 0.34, 1: 0.34, 2: 0.31}           {0: 0.098, 1: 0.29, 2: 0.39, 3: 0.23} {0: 0.46, 1: 0.54}
{1: 1.0}                              {0: 0.4, 1: 0.6}                      {0: 0.66, 1: 0.34}                    {0: 0.4, 1: 0.6}                      {0: 0.54, 1: 0.46}

$ python3 voltorb-flip.py
Enter col constraints left-to-right, then row constraints top-to-bottom as repeated "{sum} {voltorb count}"
5 0 6 1 4 2 6 1 3 2 6 1 3 2 6 0 6 1 3 2
Enter cell constraints as repeated "{row} {col} {val}"
2 1 2
num_soln 54
{1: 1.0}                              {0: 0.13, 1: 0.37, 2: 0.5}            {0: 0.3, 1: 0.2, 2: 0.5}              {0: 0.093, 1: 0.19, 2: 0.44, 3: 0.28} {0: 0.48, 1: 0.52}
{1: 1.0}                              {0: 0.37, 1: 0.63}                    {0: 0.7, 1: 0.3}                      {0: 0.41, 1: 0.59}                    {0: 0.52, 1: 0.48}
{1: 1.0}                              {2: 1.0}                              {1: 1.0}                              {1: 1.0}                              {1: 1.0}
{1: 1.0}                              {0: 0.13, 1: 0.37, 2: 0.5}            {0: 0.3, 1: 0.2, 2: 0.5}              {0: 0.093, 1: 0.19, 2: 0.44, 3: 0.28} {0: 0.48, 1: 0.52}
{1: 1.0}                              {0: 0.37, 1: 0.63}                    {0: 0.7, 1: 0.3}                      {0: 0.41, 1: 0.59}                    {0: 0.52, 1: 0.48}

About


Languages

Language:Python 100.0%