From c5d69da608e146dc033fe3aa8b3e4afb4abc8440 Mon Sep 17 00:00:00 2001 From: Rendo Date: Sat, 28 Mar 2026 17:29:00 +0500 Subject: [PATCH] Docs update --- docs/algorithms.md | 32 ++++++++++++++++++++++++++++ docs/principles | 10 --------- docs/principles.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 10 deletions(-) create mode 100644 docs/algorithms.md delete mode 100644 docs/principles create mode 100644 docs/principles.md diff --git a/docs/algorithms.md b/docs/algorithms.md new file mode 100644 index 0000000..91fdade --- /dev/null +++ b/docs/algorithms.md @@ -0,0 +1,32 @@ +# Algorithms +In this document are listed some of algorithms for the sake of planning. + +# Genome +## Generation examples +Examples section's goal is to document standard plant generation process. +Documented generation process is easier to visualize. +### Peashooter example +1. Create [generator] root +2. Add [transfer] stem +3. Add [trigger] head +4. Add [modifier] leaf +5. Return to head +6. Add [output] face +### Sunflower example +1. Create [dummy] root +2. Add [dummy] stem +3. Add [mixed] head +4. Add [output] face +### Cherry bomb example +1. Create [generator] root +2. Add [output] head +3. Add [dummy] face +4. Return to root +5. Repeat steps 3 and 4 +### Potato mine example +1. Create [generator] root +2. Add [trigger] head +3. Add [dummy] face +### Wall-nut example +1. Create [dummy] root +2. Create [dummy] face diff --git a/docs/principles b/docs/principles deleted file mode 100644 index d90f55c..0000000 --- a/docs/principles +++ /dev/null @@ -1,10 +0,0 @@ -# Principles - -This document describes principles I have came up with. I don't think I'd be angry if you use them in your projects. -This document is mostly for me to remember things. - -## The core principles are: -- Every plant can be represented as graph (sometimes as a tree). -- Every value of a node can be also a node (I might iterate on this one). -- Every node can have input and output. -- If node has input, and parent has output, parent must spread its output diff --git a/docs/principles.md b/docs/principles.md new file mode 100644 index 0000000..4ed9bd1 --- /dev/null +++ b/docs/principles.md @@ -0,0 +1,52 @@ +# Principles + +This document describes principles I have came up with. I don't think I'd be angry if you use them in your projects. +This document is mostly for me to remember things. + +## Used terms and placeholders +(Very WIP) - This section is subject to change. + - Placeholder for context arguments. Currently I didn't think of this but I acknowledge that I might need them. + - Type that doesn't exist yet but is obvious in context of section. + +## The core principles are: +- Every plant can be represented as graph (sometimes as a tree). +- Every value of a node can be also a node (I might iterate on this one). +- Every node can have input and output. +- If node has input, and parent has output, parent must spread its output. + +## Genome +### Gene +Genes are main logic elements of a plant. They're nodes of genetics graph. +I might iterate over this, but in current implementation is a little bit functional due to complications of OOP in Rust. +Gene structure consists of variables specific to gene, type and overridable methods for displaying itself and its children. + +(Very WIP) Variables: +- Dictionary with some string type as a key and Argument enum. +- Argument enum consists of f32 and i64. + +Type of gene is enum that provides different functions. Here is (Very WIP) list of every type and its provided functions: + +Dummy - gene without behaviour. + +Transfer - gene that defines rules of flow. +- `distribute_between_children(,flow: mut ) -> ` + +Pure Generator - gene that only creates flow. +- `create_flow(,current_flow: mut ) -> ` - won't be called if flow isn't empty. + +Modifier - gene that modifies or creates flow. +- `modify_flow(,current_flow: mut ) -> ` + +Consumer - gene that consumes flow. +- `consume()` + +Trigger - gene that interacts with context to conditionally progress flow. +- `check_trigger() -> bool` + +Observer - gene that observes flow. +- `observe(,current_flow: mut )` + +### Flow +Flow is data that circulates across genome. If not consumed, goes to the void. + +Currently it is something like Vec