Added feature to support optional priority for transitions#27
Open
advra wants to merge 1 commit intoprooheckcp:mainfrom
Open
Added feature to support optional priority for transitions#27advra wants to merge 1 commit intoprooheckcp:mainfrom
advra wants to merge 1 commit intoprooheckcp:mainfrom
Conversation
Owner
|
Hi, I just wanted to let you know that I didn't drop this project I'm just wrapped in too many things right now (applying for graduate programs right now). Once things cool down I'll look into all of this in detail. Thank you for taking the time for this |
Author
|
No worries. I appreciate for getting back to me. When you are ready let me know I will gladly follow up on this when you have the time. (: Also, good luck in grad school! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝Description
Before this change, transitions are treated with random ordering with no guarantee of deterministic behavior. Creating complex State Machine Diagrams results in behavior that may be hard to reproduce. This also prevents extending behaviors with specific use case.
This change adds
Optional PrioritiesTransitions. Transitions are defined like before but can also be defined with an optionalPriorityvalue. Upon initialization, a list of sorted transitions is built then used when evaluating states.This solution is performant and satisfies the original requirement Time Complexity O(1) look up.
How to use:
In this example we have an Idle State with various Transition Outputs defined by priorities. We define Transitions as usual with an optional priority number. If no priority is defined then the fallback default priority of 0 is used instead.
Note: If a state has multiple Transitions defined with no priority specified the order may vary per runtime (ie
CanFollowandRandomEmotein the example below). Under the hood each Transition id is randomly generated therefore theres no guarantees on its order.🔧Changes
_BuildTransitionsExecutionOrderto sort priorities (occurs only once upon init)👣Next steps
No further steps are necessary