Skip to content

Comments

Updated the Code to be mildly more optimized and Idiomatic to Java#1

Open
That-Madman wants to merge 11 commits intoftc16072:mainfrom
That-Madman:main
Open

Updated the Code to be mildly more optimized and Idiomatic to Java#1
That-Madman wants to merge 11 commits intoftc16072:mainfrom
That-Madman:main

Conversation

@That-Madman
Copy link

I updated several classes in minor ways to improve on them. This includes shifting variables to optimize memory allocation and allow for potentially improved behavior of the garbage collector and switching bulky if and if-else statements to more efficient or at least more legible switch statements or tenary operators, whichever suited the situation better.

I was going to change Failover to Fallback to match the code generated by the Quantum Quacks FTC Behavior Tree website, but that would cause problems with backwards compatibility.

All changes preserve original behavior and should be completely backwards compatible.

Cleaned up Not.java to properly Java best practices. This includes a minor change to the constructor to properly fit the this/arg dichotomy, and also replaced tick's return method to be more efficient through switch statements, also making it easier to read.
Move around the code for a more idiomatic format, and also allowing hopefully for a more opportunistic memory efficiency.
Applied to the same fixes of Sequence to Failover.
Fixed For loop to not have redundant variables
Made the code cleaner with a tenary operator
Mainly just some cosmetic shifts to properly indent.
Added formatting to be more legible.
Added the ability for Parallel to bail early if it cannot meet the required successes
Added an secondary Parallel version that maintains old functionality so as to allow for if a user needs to finish all running Nodes still.
updated Javadoc
Changed the name of Failover to Fallback to both fit with the Quantum Quacks behavior tree website and also the original ideas of the Behavior Trees
@That-Madman
Copy link
Author

I added a few more things, such as implementing the intended functionality for Parallel, renaming Failover to Fallback to better align with the typical name for the decorator, and also some further formatting.

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.

1 participant