//
// Created by bastian on 08.03.22.
//

#ifndef BUILD_WEIGHTEDRANDOMNODE_H
#define BUILD_WEIGHTEDRANDOMNODE_H

#include <behaviortree_cpp_v3/control_node.h>
#include <string>
#include <random>
#include <regex>

using namespace BT;

class WeightedRandomNode : public ControlNode
{
public:
    WeightedRandomNode(const std::string& name, const NodeConfiguration &config);

    ~WeightedRandomNode() override = default;

    void halt() override;

    static PortsList providedPorts();
private:
    size_t selected_child_index;
    bool select_next{};
    std::mt19937_64 rng;

    BT::NodeStatus tick() override;
};


#endif //BUILD_WEIGHTEDRANDOMNODE_H
