/** * @return array of actionPackets * @param $planList Array of graphNodes * @desc Returns the next actions and the plans associated with them */ function findNextActions($planList, $updateHistory) { $currentActions = array(); $planListSize = sizeof($planList); for ($index = 0; $index < $planListSize; $index++) { //At the goal state we will stop generating nextNodes if ($planList[$index]->getCurrentNode()) { $packet = new actionPacket($planList[$index]->getCurrentNode()); if ($updateHistory) { //Note progression along the graph $planList[$index]->progress(); } else { $planList[$index]->progressWithoutHistory(); } $packet->addPlan($planList[$index]); array_push($currentActions, $packet); } } return $currentActions; }