pygambit.gambit.Game.copy_tree#

Game.copy_tree(src: Selector, dest: Selector) None#

Copy the subtree rooted at the node identified by src to the node identified by dest.

Each node in the subtree copied to follow dest is placed in the same information set as the corresponding node in the original subtree under src.

It is permitted for dest to be a descendant of src. The operation uses the subtree rooted at src as it is at the time the function is called, so no infinite recursion is triggered.

The outcome associated with dest is not changed by this operation.

src and dest are each a Selector (an H-built expression, evaluated against this game) that must resolve to exactly one node.

Changed in version 17.0.0: src and dest are now Selector`s; a `Node or str is no longer accepted directly – build one with H.

Parameters:
  • src (Selector) – A Selector resolving to the root of the source subtree to copy.

  • dest (Selector) – A Selector resolving to the destination subtree to copy to. Must resolve to a terminal node.

Raises:
  • TypeError – If src or dest is not a Selector.

  • UndefinedOperationError – If dest is not a terminal node.

  • ValueError – If src or dest does not resolve to exactly one node.