Skip to content

Trees#20

Open
dominikstrak2001 wants to merge 1 commit intomainfrom
dominik/trees
Open

Trees#20
dominikstrak2001 wants to merge 1 commit intomainfrom
dominik/trees

Conversation

@dominikstrak2001
Copy link
Copy Markdown
Contributor

No description provided.

@dominikstrak2001 dominikstrak2001 requested a review from a team as a code owner August 10, 2024 16:25
Comment thread tree.hpp

buildTree(0, tree.root.get());
return tree;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add enter

Comment thread tree.hpp
Comment on lines +77 to +87
for (std::uint64_t i = 1; i < nodes; ++i) {
int decision = rnd.intFromRange(0, 99);

if (decision < 70) { // 70% chance to add a single child to the current node (bias towards depth)
current = current->addChild(generateValue());
} else if (decision < 90 && current->parent) { // 20% chance to move back to the parent and add a sibling
current = current->parent->addChild(generateValue());
} else { // 10% chance to add another child to the current node (increasing breadth slightly)
current->addChild(generateValue());
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This generate really special shape of trees

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants