Skip to main content

The PioSOLVER Utility Suite

Project description

Pious: The Pio Utility Suite

Pious provide a Python wrapper for a PioSOLVER instance and provides convenience functions and abstractions to make working with PioSOLVER easier.

Warning: This library is still under construction. All interfaces, classes, files, etc. will be changed. I'm open sourcing this for feedback/collaboration.

Install

Install with pip install pious. Requires Python 3.11 or later.

Solver Interface

Pious provides pious.pio.solver.Solver to wrap a PioSOLVER instance. This can be constructed directly, but we recommend using pious.pio.util.make_solver():

# examples/load_tree.py
from pious.pio.util import make_solver
from pious.pio.resources import get_test_tree

solver = make_solver()
solver.load_tree(get_test_tree())  # Replace with your tree
solver.load_all_nodes()  # Required for partial saves in Pio3
tree_info = solver.show_tree_info()
print(f"Board: {tree_info['Board']}")
print(f"Pot: {tree_info['Pot']}")
print(f"EffectiveStacks: {tree_info['EffectiveStacks']}")

lines = solver.show_all_lines()
print("Last 10 lines:", lines[-10:])

Configuration

By default make_solver will try to invoke C:\PioSOLVER\PioSOLVER3-edge.exe. You can configure default behavior by placing a pious.toml in your home directory. Here is a sample pious.toml:

[pio]
install_directory="C:\\PioSOLVER"
pio_version_no="2"
pio_version_type="pro"

Lines

PioSOLVER deals in lines (e.g., show_all_lines), such as r:0:c:c:b300:b850:c. Pious provides a high-level wrapper, Line, around low-level Pio lines that gives many quality-of-life improvements. See examples\line_example.py for details:

from pious.pio.line import Line

# ...
line = Line("r:0:c:b12:c:c:b77:b221:c:c")
print("Line:", line)
print("  IP?                 ", line.is_ip())
print("  Current Street?     ", line.current_street())
print("  Actions:            ", line.actions)
print("  Streets as Actions: ", line.streets_as_actions)
print("  Streets as Lines:   ", line.streets_as_lines)
print("  Facing Bet?         ", line.is_facing_bet())

Aggregation Reports

To use the AggregationReport, start a python session from the python directory, and import the aggregation report module. Then create a new AggregationReport by passing in the path to the folder containing the AggregationReport (and optionally including the path to the solve database that you used to generate the aggregation report). See examples\aggregation_example.py for more info:

# Excerpt from examples\aggregation_example.py

from pious.pio.aggregation import AggregationReport
import pious.pio.resources as resources

report = AggregationReport(get_aggregation_root(), get_database_root())
print(report)
print(report.describe())

report.ioff()  # turn off matplotlib's interactive mode
report.plot()  # exit report to continue

report.filter("r1 == 14") # filter for ace high boards
report.plot()

report.reset()
report.filter("r1 < 14 and flushdraw") # non ace high AND flushdraw boards
report.plot()

You can run r.plot() to get a nice visualization, r.filter() to focus only on boards you're interested in, and r.reset() to start over again.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pious-0.0.0.dev11.tar.gz (7.2 MB view details)

Uploaded Source

Built Distribution

pious-0.0.0.dev11-py3-none-any.whl (7.5 MB view details)

Uploaded Python 3

File details

Details for the file pious-0.0.0.dev11.tar.gz.

File metadata

  • Download URL: pious-0.0.0.dev11.tar.gz
  • Upload date:
  • Size: 7.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for pious-0.0.0.dev11.tar.gz
Algorithm Hash digest
SHA256 2b3cf31d3733fbf1e8365ca8a9f8f70dda747c2e8d865ba2de06d179df228ce0
MD5 a32b9f07ac74a370c2a6383e29ad3eef
BLAKE2b-256 556997ff68909974a0d773cec19ac099081c2144c78412ae082c46491b12d0c1

See more details on using hashes here.

File details

Details for the file pious-0.0.0.dev11-py3-none-any.whl.

File metadata

  • Download URL: pious-0.0.0.dev11-py3-none-any.whl
  • Upload date:
  • Size: 7.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for pious-0.0.0.dev11-py3-none-any.whl
Algorithm Hash digest
SHA256 118a0c2b6ad4244c7e149eada0c7abb709acfd5508fd9f710c4e7fb04d2bec3b
MD5 0a0cece5bc289fc9b2234e25e56a9019
BLAKE2b-256 62b90902f5cb02d5705a054b9d6912f433886bbb34a12cfd8e779f5ce0aa39d7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page