chipiron.players.move_selector.treevalue.node_factory package

Submodules

chipiron.players.move_selector.treevalue.node_factory.algorithm_node_factory module

” AlgorithmNodeFactory

class chipiron.players.move_selector.treevalue.node_factory.algorithm_node_factory.AlgorithmNodeFactory(tree_node_factory: Base[Any], board_representation_factory: RepresentationFactory[Any] | None, exploration_index_data_create: Callable[[TreeNode[Any]], NodeExplorationData | None])[source]

Bases: object

The classe creating Algorithm Nodes

board_representation_factory: RepresentationFactory[Any] | None
create(board: IBoard, half_move: int, count: int, parent_node: ITreeNode[Any] | None, move_from_parent: int | None, modifications: BoardModificationP | None) AlgorithmNode[source]

Creates an AlgorithmNode object.

Parameters:
  • move_from_parent (chess.Move | None) – the move that led to the node from the parent node

  • board – The board object.

  • half_move – The half move count.

  • count – The count.

  • parent_node – The parent node object.

  • modifications – The board modifications object.

Returns:

An AlgorithmNode object.

exploration_index_data_create: Callable[[TreeNode[Any]], NodeExplorationData | None]
tree_node_factory: Base[Any]

chipiron.players.move_selector.treevalue.node_factory.base module

Basic class for Creating Tree nodes

class chipiron.players.move_selector.treevalue.node_factory.base.Base(*args, **kwargs)[source]

Bases: TreeNodeFactory, Generic

Basic class for Creating Tree nodes

create(board: IBoard, half_move: int, count: int, parent_node: ITreeNode[Any] | None, move_from_parent: int | None, modifications: BoardModificationP | None) TreeNode[source]

Creates a new TreeNode object.

Parameters:
  • board (boards.BoardChi) – The current board state.

  • half_move (int) – The half-move count.

  • count (int) – The ID of the new node.

  • parent_node (ITreeNode | None) – The parent node of the new node.

  • move_from_parent (chess.Move | None) – The move that leads to the new node.

  • modifications (board_mod.BoardModification | None) – The modifications applied to the board.

Returns:

The newly created TreeNode object.

Return type:

TreeNode

chipiron.players.move_selector.treevalue.node_factory.factory module

This module provides a function to create a node factory based on the given node factory name.

chipiron.players.move_selector.treevalue.node_factory.factory.create_node_factory(node_factory_name: str) Base[Any][source]

Create a node factory based on the given node factory name.

Parameters:

node_factory_name (str) – The name of the node factory.

Returns:

An instance of the node factory.

Return type:

Base

Raises:

ValueError – If the given node factory name is not implemented.

chipiron.players.move_selector.treevalue.node_factory.node_factory module

TreeNodeFactory Protocol

class chipiron.players.move_selector.treevalue.node_factory.node_factory.TreeNodeFactory(*args, **kwargs)[source]

Bases: Protocol, Generic

Interface for Tree Node Factories

create(board: IBoard, half_move: int, count: int, parent_node: ITreeNode[Any] | None, move_from_parent: int | None, modifications: BoardModificationP | None) ITreeNode[source]

Creates a new TreeNode object.

Parameters:
  • board (boards.BoardChi) – The current state of the chess board.

  • half_move (int) – The number of half moves made so far in the game.

  • count (int) – The number of times this position has occurred in the game.

  • parent_node (node.ITreeNode | None) – The parent node of the new TreeNode.

  • move_from_parent (chess.Move | None) – The move that led to this position, if any.

  • modifications (board_mod.BoardModification | None) – The modifications made to the board, if any.

Returns:

The newly created TreeNode object.

Return type:

node.TreeNode

Module contents

This module provides the node factory classes for creating tree nodes in the move selector algorithm.

The available classes in this module are: - TreeNodeFactory: A base class for creating tree nodes. - Base: A base class for the node factory classes. - create_node_factory: A function for creating a node factory. - AlgorithmNodeFactory: A node factory class for the move selector algorithm.

class chipiron.players.move_selector.treevalue.node_factory.AlgorithmNodeFactory(tree_node_factory: Base[Any], board_representation_factory: RepresentationFactory[Any] | None, exploration_index_data_create: Callable[[TreeNode[Any]], NodeExplorationData | None])[source]

Bases: object

The classe creating Algorithm Nodes

board_representation_factory: RepresentationFactory[Any] | None
create(board: IBoard, half_move: int, count: int, parent_node: ITreeNode[Any] | None, move_from_parent: int | None, modifications: BoardModificationP | None) AlgorithmNode[source]

Creates an AlgorithmNode object.

Parameters:
  • move_from_parent (chess.Move | None) – the move that led to the node from the parent node

  • board – The board object.

  • half_move – The half move count.

  • count – The count.

  • parent_node – The parent node object.

  • modifications – The board modifications object.

Returns:

An AlgorithmNode object.

exploration_index_data_create: Callable[[TreeNode[Any]], NodeExplorationData | None]
tree_node_factory: Base[Any]
class chipiron.players.move_selector.treevalue.node_factory.Base(*args, **kwargs)[source]

Bases: TreeNodeFactory, Generic

Basic class for Creating Tree nodes

create(board: IBoard, half_move: int, count: int, parent_node: ITreeNode[Any] | None, move_from_parent: int | None, modifications: BoardModificationP | None) TreeNode[source]

Creates a new TreeNode object.

Parameters:
  • board (boards.BoardChi) – The current board state.

  • half_move (int) – The half-move count.

  • count (int) – The ID of the new node.

  • parent_node (ITreeNode | None) – The parent node of the new node.

  • move_from_parent (chess.Move | None) – The move that leads to the new node.

  • modifications (board_mod.BoardModification | None) – The modifications applied to the board.

Returns:

The newly created TreeNode object.

Return type:

TreeNode

class chipiron.players.move_selector.treevalue.node_factory.TreeNodeFactory(*args, **kwargs)[source]

Bases: Protocol, Generic

Interface for Tree Node Factories

create(board: IBoard, half_move: int, count: int, parent_node: ITreeNode[Any] | None, move_from_parent: int | None, modifications: BoardModificationP | None) ITreeNode[source]

Creates a new TreeNode object.

Parameters:
  • board (boards.BoardChi) – The current state of the chess board.

  • half_move (int) – The number of half moves made so far in the game.

  • count (int) – The number of times this position has occurred in the game.

  • parent_node (node.ITreeNode | None) – The parent node of the new TreeNode.

  • move_from_parent (chess.Move | None) – The move that led to this position, if any.

  • modifications (board_mod.BoardModification | None) – The modifications made to the board, if any.

Returns:

The newly created TreeNode object.

Return type:

node.TreeNode

chipiron.players.move_selector.treevalue.node_factory.create_node_factory(node_factory_name: str) Base[Any][source]

Create a node factory based on the given node factory name.

Parameters:

node_factory_name (str) – The name of the node factory.

Returns:

An instance of the node factory.

Return type:

Base

Raises:

ValueError – If the given node factory name is not implemented.