fn rebuild_planning_trace(plan: &[Transition], initial: &SPState) -> Vec<PlanningFrame> {
    let mut state = initial.clone();
    let mut result = Vec::new();

    let frame = PlanningFrame {
        state: state.clone(),
        transition: SPPath::new(),
    };
    result.push(frame);

    for t in plan {
        t.actions.iter().for_each(|a| {
            let result = a.next(&mut state);
            if result.is_err() {
                // when you have a double assign in the actions
                println!("WARNING: could not take transition for {} ({:?})", t.path(), result);
            }
        });
        state.take_transition();

        let frame = PlanningFrame {
            state: state.clone(),
            transition: t.path().clone(),
        };

        result.push(frame);
    }
    result
}
// create a planning result based on an initial state and a sequence
// of transitions. this is to make it easy to try to rearrange plans.
create a planning result based on an initial state and a sequence
of transitions. this is to make it easy to try to rearrange plans.
create a planning result based on an initial state and a sequence of transitions . this is to make it easy to try to rearrange plans .
fn rebuild_planning_trace(plan: &[Transition], initial: &SPState) -> Vec<PlanningFrame> {
    let mut state = initial.clone();
    let mut result = Vec::new();
    let frame = PlanningFrame {
        state: state.clone(),
        transition: SPPath::new(),
    };
    result.push(frame);
    for t in plan {
        t.actions.iter().for_each(|a| {
            let result = a.next(&mut state);
            if result.is_err() {
                // when you have a double assign in the actions
                println!("WARNING: could not take transition for {} ({:?})", t.path(), result);
            }
        });
        state.take_transition();
        let frame = PlanningFrame {
            state: state.clone(),
            transition: t.path().clone(),
        };
        result.push(frame);
    }
    result
}
fn rebuild_planning_trace ( plan : & [ Transition ] , initial : & SPState ) -> Vec < PlanningFrame > { let mut state = initial . clone ( ) ; let mut result = Vec :: new ( ) ; let frame = PlanningFrame { state : state . clone ( ) , transition : SPPath :: new ( ) , } ; result . push ( frame ) ; for t in plan { t . actions . iter ( ) . for_each ( | a | { let result = a . next ( & mut state ) ; if result . is_err ( ) { // when you have a double assign in the actions println ! ( " " t path ( ) result ) ; } } ) ; state . take_transition ( ) ; let frame = PlanningFrame { state : state . clone ( ) , transition : t . path ( ) . clone ( ) , } ; result . push ( frame ) ; } result }
create a planning result based on an initial state and a sequence
of transitions.
create a planning result based on an initial state and a sequence of transitions .
plan
&[Transition]
initial
&SPState