chipiron.players.move_selector.treevalue.node_evaluator package

Subpackages

Submodules

chipiron.players.move_selector.treevalue.node_evaluator.all_node_evaluators module

This module defines the different types of node evaluators used in the tree value calculation.

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

Bases: str, Enum

Enum class representing different types of node evaluators.

BasicEvaluation = 'basic_evaluation'
NeuralNetwork = 'neural_network'

chipiron.players.move_selector.treevalue.node_evaluator.factory module

This module provides a factory function for creating node evaluators based on different types of board evaluators.

chipiron.players.move_selector.treevalue.node_evaluator.factory.create_node_evaluator(arg_board_evaluator: NeuralNetNodeEvalArgs | BasicEvaluationNodeEvaluatorArgs, syzygy: SyzygyTable[Any] | None) NodeEvaluator[source]

Create a node evaluator based on the given board evaluator argument and syzygy table.

Parameters:
  • arg_board_evaluator (AllNodeEvaluatorArgs) – The argument for the board evaluator.

  • syzygy (SyzygyTable | None) – The syzygy table to be used for evaluation.

Returns:

The created node evaluator.

Return type:

NodeEvaluator

Raises:

SystemExit – If the given board evaluator type is not found.

chipiron.players.move_selector.treevalue.node_evaluator.node_evaluator module

This module contains the implementation of the NodeEvaluator class, which is responsible for evaluating the value of

nodes in a tree-based move selector.

The NodeEvaluator class wraps a board evaluator and a syzygy table to provide more complex evaluations of chess

positions. It handles queries for evaluating nodes and manages obvious over events.

Classes: - NodeEvaluator: Wrapping node evaluator with syzygy and obvious over event.

Enums: - NodeEvaluatorTypes: Types of node evaluators.

Constants: - DISCOUNT: Discount factor used in the evaluation.

Functions: - None

class chipiron.players.move_selector.treevalue.node_evaluator.node_evaluator.EvaluationQueries[source]

Bases: object

A class that represents evaluation queries for algorithm nodes.

Variables:
  • over_nodes (list[AlgorithmNode]) – A list of algorithm nodes that are considered “over”.

  • not_over_nodes (list[AlgorithmNode]) – A list of algorithm nodes that are not considered “over”.

clear_queries() None[source]

Clears the evaluation queries by resetting the over_nodes and not_over_nodes lists.

not_over_nodes: list[chipiron.players.move_selector.treevalue.nodes.algorithm_node.algorithm_node.AlgorithmNode]
over_nodes: list[chipiron.players.move_selector.treevalue.nodes.algorithm_node.algorithm_node.AlgorithmNode]
class chipiron.players.move_selector.treevalue.node_evaluator.node_evaluator.NodeEvaluator(master_board_evaluator: MasterBoardEvaluator)[source]

Bases: object

The NodeEvaluator class is responsible for evaluating the value of nodes in a tree structure. It uses a board evaluator and a syzygy evaluator to calculate the value of the nodes.

add_evaluation_query(node: AlgorithmNode, evaluation_queries: EvaluationQueries) None[source]

Adds an evaluation query for a node.

check_obvious_over_events(node: AlgorithmNode) None[source]

Updates the node.over object if the game is obviously over.

evaluate_all_not_over(not_over_nodes: list[chipiron.players.move_selector.treevalue.nodes.algorithm_node.algorithm_node.AlgorithmNode]) None[source]

Evaluates all the nodes that are not over.

evaluate_all_queried_nodes(evaluation_queries: EvaluationQueries) None[source]

Evaluates all the queried nodes.

master_board_evaluator: MasterBoardEvaluator
process_evalution_not_over(evaluation: float, node: AlgorithmNode) float[source]

Processes the evaluation for a node that is not over.

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

Bases: str, Enum

Enum class representing different types of node evaluators.

NeuralNetwork = 'neural_network'

chipiron.players.move_selector.treevalue.node_evaluator.node_evaluator_args module

This module defines the NodeEvaluatorArgs class, which represents the arguments for a node evaluator.

Classes: - NodeEvaluatorArgs: Represents the arguments for a node evaluator.

class chipiron.players.move_selector.treevalue.node_evaluator.node_evaluator_args.BasicEvaluationNodeEvaluatorArgs(syzygy_evaluation: bool, internal_representation_type: ~chipiron.players.boardevaluators.neural_networks.input_converters.ModelInputRepresentationType.InternalTensorRepresentationType, evaluation_scale: ~chipiron.players.boardevaluators.evaluation_scale.EvaluationScale, type: ~typing.Literal[<NodeEvaluatorTypes.BasicEvaluation: 'basic_evaluation'>])[source]

Bases: NodeEvaluatorArgs

Represents the arguments for a node evaluator.

type: BasicEvaluation: 'basic_evaluation'>]
class chipiron.players.move_selector.treevalue.node_evaluator.node_evaluator_args.NodeEvaluatorArgs(syzygy_evaluation: bool, internal_representation_type: InternalTensorRepresentationType, evaluation_scale: EvaluationScale)[source]

Bases: object

Represents the arguments for a node evaluator.

Attributes: - type: The type of the node evaluator. - syzygy_evaluation: A boolean indicating whether syzygy evaluation is enabled. - representation: The representation of the node evaluator.

evaluation_scale: EvaluationScale
internal_representation_type: InternalTensorRepresentationType
syzygy_evaluation: bool

Module contents

This module provides functionality for evaluating nodes in a tree structure.

The module includes a factory function for creating node evaluators, as well as classes for representing node evaluators, evaluation queries, and node evaluator arguments.

Available objects: - AllNodeEvaluatorArgs: A named tuple representing all the arguments for creating a node evaluator. - NodeEvaluator: A class representing a node evaluator. - create_node_evaluator: A factory function for creating a node evaluator. - EvaluationQueries: An enumeration representing different types of evaluation queries. - NodeEvaluatorArgs: A class representing the arguments for creating a node evaluator.

class chipiron.players.move_selector.treevalue.node_evaluator.EvaluationQueries[source]

Bases: object

A class that represents evaluation queries for algorithm nodes.

Variables:
  • over_nodes (list[AlgorithmNode]) – A list of algorithm nodes that are considered “over”.

  • not_over_nodes (list[AlgorithmNode]) – A list of algorithm nodes that are not considered “over”.

clear_queries() None[source]

Clears the evaluation queries by resetting the over_nodes and not_over_nodes lists.

not_over_nodes: list[chipiron.players.move_selector.treevalue.nodes.algorithm_node.algorithm_node.AlgorithmNode]
over_nodes: list[chipiron.players.move_selector.treevalue.nodes.algorithm_node.algorithm_node.AlgorithmNode]
class chipiron.players.move_selector.treevalue.node_evaluator.NodeEvaluator(master_board_evaluator: MasterBoardEvaluator)[source]

Bases: object

The NodeEvaluator class is responsible for evaluating the value of nodes in a tree structure. It uses a board evaluator and a syzygy evaluator to calculate the value of the nodes.

add_evaluation_query(node: AlgorithmNode, evaluation_queries: EvaluationQueries) None[source]

Adds an evaluation query for a node.

check_obvious_over_events(node: AlgorithmNode) None[source]

Updates the node.over object if the game is obviously over.

evaluate_all_not_over(not_over_nodes: list[chipiron.players.move_selector.treevalue.nodes.algorithm_node.algorithm_node.AlgorithmNode]) None[source]

Evaluates all the nodes that are not over.

evaluate_all_queried_nodes(evaluation_queries: EvaluationQueries) None[source]

Evaluates all the queried nodes.

master_board_evaluator: MasterBoardEvaluator
process_evalution_not_over(evaluation: float, node: AlgorithmNode) float[source]

Processes the evaluation for a node that is not over.

class chipiron.players.move_selector.treevalue.node_evaluator.NodeEvaluatorArgs(syzygy_evaluation: bool, internal_representation_type: InternalTensorRepresentationType, evaluation_scale: EvaluationScale)[source]

Bases: object

Represents the arguments for a node evaluator.

Attributes: - type: The type of the node evaluator. - syzygy_evaluation: A boolean indicating whether syzygy evaluation is enabled. - representation: The representation of the node evaluator.

evaluation_scale: EvaluationScale
internal_representation_type: InternalTensorRepresentationType
syzygy_evaluation: bool
chipiron.players.move_selector.treevalue.node_evaluator.create_node_evaluator(arg_board_evaluator: NeuralNetNodeEvalArgs | BasicEvaluationNodeEvaluatorArgs, syzygy: SyzygyTable[Any] | None) NodeEvaluator[source]

Create a node evaluator based on the given board evaluator argument and syzygy table.

Parameters:
  • arg_board_evaluator (AllNodeEvaluatorArgs) – The argument for the board evaluator.

  • syzygy (SyzygyTable | None) – The syzygy table to be used for evaluation.

Returns:

The created node evaluator.

Return type:

NodeEvaluator

Raises:

SystemExit – If the given board evaluator type is not found.