EvolvingBehavior  0.2.0
 
Loading...
Searching...
No Matches
BTChromosomeUtils Class Reference

Helpful utility functions for our chromosomes. More...

#include <BTChromosomeUtils.h>

Static Public Member Functions

static bool FindRandomNodeOfType (UBTChromosome *chromosome, URandomGen *random, UClass *nodeClass, UBTCompositeNodeGene *&outParent, uint16 &outChildIdx, UBTNodeGene *&resultNode)
 
template<typename NodeT >
static bool FindRandomNode (UBTChromosome *chromosome, URandomGen *randomGen, UBTCompositeNodeGene *&outParent, uint16 &outChildIdx, NodeT *&resultNode)
 
static int CountNumNodesOfType (UBTChromosome *chromosome, UClass *nodeClass)
 
template<typename NodeT >
static int CountNumNodes (UBTChromosome *chromosome)
 
static void DepthFirstSearch (UBTChromosome *chromosome, std::function< bool(UBTNodeGene *, UBTCompositeNodeGene *, uint16)> nodeFunc)
 Performs a depth-first search on the given chromsome, calling a given function on each node. More...
 
static bool DepthFirstSearch (UBTCompositeNodeGene *composite, UBTCompositeNodeGene *parent, uint16 compositeIdx, std::function< bool(UBTNodeGene *, UBTCompositeNodeGene *, uint16)> nodeFunc, TArray< UBTNodeGene * > seenNodes)
 
static bool ContainsACycle (UBTChromosome *chromosome)
 
static int DepthOfTree (UBTChromosome *chromosome)
 
static bool CheckForPointerCollisions (UBTCompositeNodeGene *composite, UBTCompositeNodeGene *other)
 
static bool CheckForPointerCollisions (UBTChromosome *chromosome, UBTChromosome *other)
 
static bool PickNodeAtLayer (UBTChromosome *chromosome, int layer, UBTCompositeNodeGene *&outParent, uint16 &outChildIdx, UBTNodeGene *&resultNode)
 

Detailed Description

Helpful utility functions for our chromosomes.

Author
npc
Date
12/12/17

Member Function Documentation

◆ DepthFirstSearch()

void BTChromosomeUtils::DepthFirstSearch ( UBTChromosome chromosome,
std::function< bool(UBTNodeGene *, UBTCompositeNodeGene *, uint16)>  nodeFunc 
)
static

Performs a depth-first search on the given chromsome, calling a given function on each node.

Parameters
chromosomeThe chromosome to search.
nodeFuncThe function to call on each node in the chromosome.

The documentation for this class was generated from the following files:
  • Source/EvolvingBehavior/Public/BTChromosomeUtils.h
  • Source/EvolvingBehavior/Private/BTChromosomeUtils.cpp