Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(WIP) Behavior Tree Proof of Concept #155

Closed
wants to merge 1 commit into from
Closed

(WIP) Behavior Tree Proof of Concept #155

wants to merge 1 commit into from

Conversation

elicwhite
Copy link
Contributor

As talked about in #142, I want to explore the possibility of breaking the bot into extensible, possibly shared, configurable tasks. This is the first step in that direction and I would love any feedback people have on the implementation

tasks = []

for taskConfig in self.config.tasks:
taskRef = globals()[taskConfig['type']]
Copy link
Member

@douglascamata douglascamata Jul 22, 2016

Choose a reason for hiding this comment

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

globals() is really bad behaviour. Please encapsulate properly.

Also taskConfig is CamelCase and we use snake_case for variables and functions. CamelCase only for class definitions. This is following Python standards, defined as in pep-8.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not very familiar with python, the thinking here is that we want to be able to instantiate these tasks by name. It's probably the right choice to just put a switch statement in for now. If we were trying to support a plugin system at this point, we would need to figure out some way to dynamically pull those in and instantiate by string name. Overengineering at this point though. :)

@douglascamata
Copy link
Member

@TheSavior you tasks implementation looks a lot like our workers. Please keep them in mind when you do your work, because they are used already to process cells (which can be pokemons) and then action are taken in each of those cells by these workers.

@elicwhite
Copy link
Contributor Author

@douglascamata I agree that the tasks and workers seem very similar. I think the biggest difference is that I want to get these tasks more standalone than the workers are. Currently a lot of the logic is not actually in the worker. For example, the stepper essentially tells the worker which pokemon to catch. Since it iterates over each visible pokemon, if you fill up your bag while catching, the worker will be stuck.

So in the case of the catch pokemon task, the goal would be for it to figure out what is visible, pick one, catch it, and return.

@douglascamata
Copy link
Member

@TheSavior that's expected, because the Stepper class will be the one to decide where to go. So we can add logic in it to avoid walking to pokemons when have no balls, for example.

@douglascamata
Copy link
Member

And then we can have many classes to decide where to go based on the current state.

@elicwhite
Copy link
Contributor Author

elicwhite commented Jul 22, 2016

@douglascamata I messaged you on gitter. I'd love to chat this out, and make sure I'm heading in the right direction.

One of the side effects of the problem I'm trying to solve in #142 would actually pull out that decision making logic from the stepper. Having it in the stepper makes it hard to extend, configure, and swap out. Take a look at the linked issue where I walk through it a bit more and see if it makes sense where I'm coming from.

Edit, I'm now on the slack channel.

@jtdroste
Copy link
Contributor

@TheSavior we moved to slack. To get an invite, go here

@elicwhite
Copy link
Contributor Author

Closing the PR for now. After talking to @douglascamata it sounds like there are a bunch of bigger things that need to be worked on now that will cause problems in the short term for this refactor.

We'll revisit this soon, so let's continue the conversation in #142 and try to get a good grasp on the approach and implication. It sounds like @douglascamata had something a tad different in mind, so it would be good to figure this stuff out in the mean time.

@elicwhite elicwhite closed this Jul 22, 2016
hoanghuynh pushed a commit to hoanghuynh/PokemonGo-Bot that referenced this pull request Sep 28, 2016
added werkzeug version requirement
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.

3 participants