chipiron.players.move_selector.treevalue.indices package

Subpackages

Submodules

chipiron.players.move_selector.treevalue.indices.test_indices module

This module contains functions for testing the indices used in the move selector tree.

The main functions in this module are: - make_tree_from_file: Creates a move and value tree from a YAML file. - check_from_file: Compares the indices computed from the tree with the expected indices from a YAML file. - check_index: Tests the indices for a specific index computation type and tree file. - test_indices: Runs the index tests for multiple index computation types and tree files.

class chipiron.players.move_selector.treevalue.indices.test_indices.TestResult(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Enumeration for the test results.

FAILED = 1
PASSED = 0
WARNING = 2
chipiron.players.move_selector.treevalue.indices.test_indices.check_from_file(file_path: str | PathLike[str], tree: MoveAndValueTree) None[source]

Check the values in the given file against the values in the tree.

Parameters:
  • file_path (str) – The path to the file containing the values to check.

  • tree (MoveAndValueTree) – The tree containing the values to compare against.

Returns:

None

chipiron.players.move_selector.treevalue.indices.test_indices.check_index(index_computation: IndexComputationType, tree_file: str | PathLike[str]) TestResult[source]

Checks the index for a given tree file and index computation type.

Parameters:
  • index_computation (IndexComputationType) – The type of index computation.

  • tree_file (path) – The path to the tree file.

Returns:

The result of the index check.

Return type:

TestResult

Raises:

None

chipiron.players.move_selector.treevalue.indices.test_indices.make_tree_from_file(file_path: str | PathLike[str], index_computation: IndexComputationType) MoveAndValueTree[source]

Creates a move and value tree from a file.

Parameters:
  • file_path (path) – The path to the file containing the tree data.

  • index_computation (IndexComputationType) – The type of index computation to use.

Returns:

The created move and value tree.

Return type:

MoveAndValueTree

chipiron.players.move_selector.treevalue.indices.test_indices.test_indices() None[source]

Test the index computations on multiple tree files.

This function iterates over a list of index computations and tree files, and performs a test for each combination. The results of the tests are stored in a dictionary.

Returns:

None

Module contents