Skip to content

Ensure append_move and other functions to apply labels to nodes by default #553

@edwardchalstrey1

Description

@edwardchalstrey1

This feature request is for...

PyGambit

Requested enahancement or feature

I find it much clearer to specify nodes using labels wherever possible.

So after doing the following:

g.append_move(
    g.root,
    player="Buyer",
    actions=["Trust", "Not trust"]
)

I want to be able to do:

g.append_move(
    g.root.children["Trust"],  # Using the action label here
    player="Seller",
    actions=["Honor", "Abuse"]
)

However, currently the action labels are not applied by default, meaning the first step becomes:

g.append_move(
    g.root,
    player="Buyer",
    actions=["Trust", "Not trust"]
)
g.root.children[0].label = "Trust"
g.root.children[1].label = "Not trust"

Intuitively I expect to not have to apply the labels separately

Changes to make

  • Update append_move to apply labels
  • Also would be great if labels were inherited when doing append_infoset

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementpythonItems which involve coding in Python

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions