pub struct NodeData {
pub id: NodeId,
pub node_type: NodeType,
pub label: String,
pub actions: Vec<String>,
pub children: Vec<NodeId>,
pub parent: Option<NodeId>,
pub incoming_action: Option<String>,
}Expand description
Data associated with a node in the game tree.
Fields§
§id: NodeIdUnique identifier for this node.
node_type: NodeTypeThe type of this node.
label: StringLabel for this node (e.g., description of the game state).
actions: Vec<String>Actions available at this node (labels).
children: Vec<NodeId>Children node IDs, one per action.
parent: Option<NodeId>Parent node ID (None for root).
incoming_action: Option<String>The action label that led to this node from its parent.
Implementations§
Source§impl NodeData
impl NodeData
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Is this a terminal node?
Sourcepub fn is_decision(&self) -> bool
pub fn is_decision(&self) -> bool
Is this a decision node?
Sourcepub fn player(&self) -> PlayerId
pub fn player(&self) -> PlayerId
Get the player at this decision node (panics if not a decision node).
Sourcepub fn payoffs(&self) -> &[Payoff] ⓘ
pub fn payoffs(&self) -> &[Payoff] ⓘ
Get payoffs at this terminal node (panics if not terminal).
Sourcepub fn num_actions(&self) -> usize
pub fn num_actions(&self) -> usize
Get the number of actions at this node.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NodeData
impl RefUnwindSafe for NodeData
impl Send for NodeData
impl Sync for NodeData
impl Unpin for NodeData
impl UnsafeUnpin for NodeData
impl UnwindSafe for NodeData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more