eykd / owyl Goto Github PK
View Code? Open in Web Editor NEWA python behavior tree for implementing fast and flexible AI.
License: BSD 3-Clause "New" or "Revised" License
A python behavior tree for implementing fast and flexible AI.
License: BSD 3-Clause "New" or "Revised" License
Running an Owyl tree and something else concurrently in the same application is only possible with threading right now.
There is a safer and more modern alternative - asyncio, which is in the standard library. Lots of libraries are already compatible with it. This can also be a good time to upgrade Owyl to Python3.
It helps a lot that Asyncio's code patterns are very similar to Owyl's:
@owyl.parent_task
def sequence(*children, **kwargs):
final_value = True
for child in children:
result = yield child(**kwargs)
if not result and result is not None:
final_value = False
break
yield final_value
@asyncio.coroutine
def sequence(*children, **kwargs):
for coroutine in children:
result = yield from coroutine(**kwargs)
if not result:
return False
return True
The #2 PR appears to have dredged up a bunch of problems. In mucking around with parallel
I've realized that sequence
and selector
leak child return values:
tree = owyl.sequence(owyl.succeed(),
owyl.succeed(),
owyl.fail(),
owyl.succeed())
v = owyl.visit(tree)
results = [x for x in v if x is not None]
self.assertEqual(results, [True, True, False, False])
See how the succeed()
/succeed()
/fail()
leaks out to the results? The first three results are from the sequence
children, while the 4th result is the sequence
itself failing.
It's been a few years since I designed this library, but I can't think for the life of me why they would do that. Do any of you using owyl depend on this behavior?
This is not an issue, but an FYI.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.