behavior_tree 0.1.3 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9292399b6acb1ee8ffef9a9f95765ebff87cbb93082ffe3c9d3b3d6eee0d2305
4
- data.tar.gz: c6207934390df418f31c8184491932238f9c7d63f7c9091f3b3d21ee9d3f3505
3
+ metadata.gz: 6e5666327f1ba46c295f52817fa6655e407628d9d46bb23a19f8883102b04235
4
+ data.tar.gz: ffcfea3b0c4a663dbb88b6adb15e07a9a5e87340484d8fddeaab9431305bb624
5
5
  SHA512:
6
- metadata.gz: 9d16a12f919cddc7a2e26042a805b93bece1863efacf0ba551f55783ec05bbd8d79f7b7f03c56170000b1211480efdec001b6a90ee6be38295889bff583dadd1
7
- data.tar.gz: 53b2c03a6fc2741bae2d74a9e715d96fa92f543b1cfdf92519e9540d7c64794855c728b89a8db8b48519a42debee4fee4a1a64bb351331db926c2e9785c22d0c
6
+ metadata.gz: b686cefdec1e0dbee7ea0fc738ff759984e70c4f564ccf18927cf4f19ee583092c7d81247aec61f23256e9eca6aa2126e84e318e67a05328a9b918a8988c9ffa
7
+ data.tar.gz: 6ae47ac4b40696d6ac31b462786f8d5ccf1a5b6eaa8e06786e8491f2b13f341198cb0e992d6237fee1dbdc4874881832f9a4f09fef38d8c033fdcb2538fb63b5
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,86 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+ NewCops: enable
4
+ Gemspec/DateAssignment: # (new in 1.10)
5
+ Enabled: true
6
+ Layout/LineEndStringConcatenationIndentation: # (new in 1.18)
7
+ Enabled: true
8
+ Layout/SpaceBeforeBrackets: # (new in 1.7)
9
+ Enabled: true
10
+ Lint/AmbiguousAssignment: # (new in 1.7)
11
+ Enabled: true
12
+ Lint/DeprecatedConstants: # (new in 1.8)
13
+ Enabled: true
14
+ Lint/DuplicateBranch: # (new in 1.3)
15
+ Enabled: true
16
+ Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
17
+ Enabled: true
18
+ Lint/EmptyBlock: # (new in 1.1)
19
+ Enabled: true
20
+ Lint/EmptyClass: # (new in 1.3)
21
+ Enabled: true
22
+ Lint/EmptyInPattern: # (new in 1.16)
23
+ Enabled: true
24
+ Lint/LambdaWithoutLiteralBlock: # (new in 1.8)
25
+ Enabled: true
26
+ Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
27
+ Enabled: true
28
+ Lint/NumberedParameterAssignment: # (new in 1.9)
29
+ Enabled: true
30
+ Lint/OrAssignmentToConstant: # (new in 1.9)
31
+ Enabled: true
32
+ Lint/RedundantDirGlobSort: # (new in 1.8)
33
+ Enabled: true
34
+ Lint/SymbolConversion: # (new in 1.9)
35
+ Enabled: true
36
+ Lint/ToEnumArguments: # (new in 1.1)
37
+ Enabled: true
38
+ Lint/TripleQuotes: # (new in 1.9)
39
+ Enabled: true
40
+ Lint/UnexpectedBlockArity: # (new in 1.5)
41
+ Enabled: true
42
+ Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
43
+ Enabled: true
44
+ Naming/InclusiveLanguage: # (new in 1.18)
45
+ Enabled: true
46
+ Style/ArgumentsForwarding: # (new in 1.1)
47
+ Enabled: true
48
+ Style/CollectionCompact: # (new in 1.2)
49
+ Enabled: true
50
+ Style/DocumentDynamicEvalDefinition: # (new in 1.1)
51
+ Enabled: true
52
+ Style/EndlessMethod: # (new in 1.8)
53
+ Enabled: true
54
+ Style/HashConversion: # (new in 1.10)
55
+ Enabled: true
56
+ Style/HashExcept: # (new in 1.7)
57
+ Enabled: true
58
+ Style/IfWithBooleanLiteralBranches: # (new in 1.9)
59
+ Enabled: true
60
+ Style/InPatternThen: # (new in 1.16)
61
+ Enabled: true
62
+ Style/MultilineInPatternThen: # (new in 1.16)
63
+ Enabled: true
64
+ Style/NegatedIfElseCondition: # (new in 1.2)
65
+ Enabled: true
66
+ Style/NilLambda: # (new in 1.3)
67
+ Enabled: true
68
+ Style/QuotedSymbols: # (new in 1.16)
69
+ Enabled: true
70
+ Style/RedundantArgument: # (new in 1.4)
71
+ Enabled: true
72
+ Style/StringChars: # (new in 1.12)
73
+ Enabled: true
74
+ Style/SwapValues: # (new in 1.1)
75
+ Enabled: true
76
+ Metrics/BlockLength:
77
+ Exclude:
78
+ - spec/**/*.rb
79
+ Layout/HashAlignment:
80
+ EnforcedColonStyle: table
81
+ Metrics/ClassLength:
82
+ Max: 80
83
+ Style/LambdaCall:
84
+ EnforcedStyle: braces
85
+ Style/Lambda:
86
+ EnforcedStyle: literal
data/.travis.yml ADDED
@@ -0,0 +1,2 @@
1
+ language: ruby
2
+ rvm: 2.7.0 # Travis doesn't find the gem did_you_mean when using 2.6.0 for some reason.
@@ -0,0 +1,127 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at felovilches@gmail.com.
63
+ All complaints will be reviewed and investigated promptly and fairly.
64
+
65
+ All community leaders are obligated to respect the privacy and security of the
66
+ reporter of any incident.
67
+
68
+ ## Enforcement Guidelines
69
+
70
+ Community leaders will follow these Community Impact Guidelines in determining
71
+ the consequences for any action they deem in violation of this Code of Conduct:
72
+
73
+ ### 1. Correction
74
+
75
+ **Community Impact**: Use of inappropriate language or other behavior deemed
76
+ unprofessional or unwelcome in the community.
77
+
78
+ **Consequence**: A private, written warning from community leaders, providing
79
+ clarity around the nature of the violation and an explanation of why the
80
+ behavior was inappropriate. A public apology may be requested.
81
+
82
+ ### 2. Warning
83
+
84
+ **Community Impact**: A violation through a single incident or series
85
+ of actions.
86
+
87
+ **Consequence**: A warning with consequences for continued behavior. No
88
+ interaction with the people involved, including unsolicited interaction with
89
+ those enforcing the Code of Conduct, for a specified period of time. This
90
+ includes avoiding interactions in community spaces as well as external channels
91
+ like social media. Violating these terms may lead to a temporary or
92
+ permanent ban.
93
+
94
+ ### 3. Temporary Ban
95
+
96
+ **Community Impact**: A serious violation of community standards, including
97
+ sustained inappropriate behavior.
98
+
99
+ **Consequence**: A temporary ban from any sort of interaction or public
100
+ communication with the community for a specified period of time. No public or
101
+ private interaction with the people involved, including unsolicited interaction
102
+ with those enforcing the Code of Conduct, is allowed during this period.
103
+ Violating these terms may lead to a permanent ban.
104
+
105
+ ### 4. Permanent Ban
106
+
107
+ **Community Impact**: Demonstrating a pattern of violation of community
108
+ standards, including sustained inappropriate behavior, harassment of an
109
+ individual, or aggression toward or disparagement of classes of individuals.
110
+
111
+ **Consequence**: A permanent ban from any sort of public interaction within
112
+ the community.
113
+
114
+ ## Attribution
115
+
116
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
117
+ version 2.0, available at
118
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
119
+
120
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
121
+ enforcement ladder](https://github.com/mozilla/diversity).
122
+
123
+ [homepage]: https://www.contributor-covenant.org
124
+
125
+ For answers to common questions about this code of conduct, see the FAQ at
126
+ https://www.contributor-covenant.org/faq. Translations are available at
127
+ https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ group :development do
8
+ gem 'rubocop'
9
+ gem 'rubocop-rake'
10
+ gem 'rubocop-rspec'
11
+ end
12
+
13
+ group :development, :test do
14
+ gem 'rake'
15
+ gem 'rspec'
16
+ end
17
+
18
+ group :test do
19
+ gem 'simplecov', require: false
20
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,72 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ behavior_tree (0.1.8)
5
+ colorize (~> 0.8.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ colorize (0.8.1)
12
+ diff-lcs (1.4.4)
13
+ docile (1.4.0)
14
+ parallel (1.20.1)
15
+ parser (3.0.2.0)
16
+ ast (~> 2.4.1)
17
+ rainbow (3.0.0)
18
+ rake (13.0.6)
19
+ regexp_parser (2.1.1)
20
+ rexml (3.2.5)
21
+ rspec (3.10.0)
22
+ rspec-core (~> 3.10.0)
23
+ rspec-expectations (~> 3.10.0)
24
+ rspec-mocks (~> 3.10.0)
25
+ rspec-core (3.10.1)
26
+ rspec-support (~> 3.10.0)
27
+ rspec-expectations (3.10.1)
28
+ diff-lcs (>= 1.2.0, < 2.0)
29
+ rspec-support (~> 3.10.0)
30
+ rspec-mocks (3.10.2)
31
+ diff-lcs (>= 1.2.0, < 2.0)
32
+ rspec-support (~> 3.10.0)
33
+ rspec-support (3.10.2)
34
+ rubocop (1.18.3)
35
+ parallel (~> 1.10)
36
+ parser (>= 3.0.0.0)
37
+ rainbow (>= 2.2.2, < 4.0)
38
+ regexp_parser (>= 1.8, < 3.0)
39
+ rexml
40
+ rubocop-ast (>= 1.7.0, < 2.0)
41
+ ruby-progressbar (~> 1.7)
42
+ unicode-display_width (>= 1.4.0, < 3.0)
43
+ rubocop-ast (1.8.0)
44
+ parser (>= 3.0.1.1)
45
+ rubocop-rake (0.6.0)
46
+ rubocop (~> 1.0)
47
+ rubocop-rspec (2.4.0)
48
+ rubocop (~> 1.0)
49
+ rubocop-ast (>= 1.1.0)
50
+ ruby-progressbar (1.11.0)
51
+ simplecov (0.21.2)
52
+ docile (~> 1.1)
53
+ simplecov-html (~> 0.11)
54
+ simplecov_json_formatter (~> 0.1)
55
+ simplecov-html (0.12.3)
56
+ simplecov_json_formatter (0.1.3)
57
+ unicode-display_width (2.0.0)
58
+
59
+ PLATFORMS
60
+ ruby
61
+
62
+ DEPENDENCIES
63
+ behavior_tree!
64
+ rake
65
+ rspec
66
+ rubocop
67
+ rubocop-rake
68
+ rubocop-rspec
69
+ simplecov
70
+
71
+ BUNDLED WITH
72
+ 2.1.2
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Felo Vilches
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # Ruby Behavior Tree
2
+
3
+ ![](https://api.travis-ci.com/FeloVilches/Ruby-Behavior-Tree.svg?branch=main)
4
+
5
+ ============
6
+
7
+ (Copy from the auto-generated readme file. Some names changed, so some things are incorrect.)
8
+
9
+ WIP
10
+
11
+ ============
12
+
13
+ # Ruby::Behavior::Tree
14
+
15
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ruby/behavior/tree`. To experiment with that code, run `bin/console` for an interactive prompt.
16
+
17
+ TODO: Delete this and the text above, and describe your gem
18
+
19
+ ## Installation
20
+
21
+ Add this line to your application's Gemfile:
22
+
23
+ ```ruby
24
+ gem 'ruby-behavior-tree'
25
+ ```
26
+
27
+ And then execute:
28
+
29
+ $ bundle install
30
+
31
+ Or install it yourself as:
32
+
33
+ $ gem install ruby-behavior-tree
34
+
35
+ ## Usage
36
+
37
+ TODO: Write usage instructions here
38
+
39
+ ## Development
40
+
41
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
42
+
43
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
44
+
45
+ ## Contributing
46
+
47
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ruby-behavior-tree. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/ruby-behavior-tree/blob/master/CODE_OF_CONDUCT.md).
48
+
49
+
50
+ ## License
51
+
52
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
53
+
54
+ ## Code of Conduct
55
+
56
+ Everyone interacting in the Ruby::Behavior::Tree project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/ruby-behavior-tree/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rubocop/rake_task'
4
+ require 'bundler/gem_tasks'
5
+ require 'rspec/core/rake_task'
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ task default: %i[lint spec]
10
+
11
+ desc 'Run RuboCop'
12
+ RuboCop::RakeTask.new(:lint) do |task|
13
+ task.options = ['--fail-level', 'autocorrect']
14
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/behavior_tree/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'behavior_tree' # TODO: Change?
7
+ spec.version = BehaviorTree::VERSION
8
+ spec.authors = ['Felo Vilches']
9
+ spec.email = ['felovilches@gmail.com']
10
+
11
+ spec.summary = 'Behavior Tree (AI) library for Ruby.'
12
+ spec.homepage = 'https://github.com/FeloVilches/Ruby-Behavior-Tree' # TODO: Change?
13
+ spec.license = 'MIT'
14
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
15
+
16
+ # spec.metadata['allowed_push_host'] = 'TODO: Set to 'http://mygemserver.com''
17
+ # spec.metadata['homepage_uri'] = spec.homepage
18
+ # spec.metadata['source_code_uri'] = 'TODO: Put your gem's public repo URL here.'
19
+ # spec.metadata['changelog_uri'] = 'TODO: Put your gem's CHANGELOG.md URL here.'
20
+
21
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
22
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
23
+ end
24
+ spec.bindir = 'exe'
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ['lib']
27
+
28
+ spec.add_dependency 'colorize', '~> 0.8.1'
29
+ end
data/bin/console ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'bundler/setup'
6
+ require 'behavior_tree'
7
+
8
+ # You can add fixtures and/or initialization code here to make experimenting
9
+ # with your gem easier. You can also use a different console, if you like.
10
+
11
+ # (If you use this, don't forget to add pry to your Gemfile!)
12
+ # require 'pry'
13
+ # Pry.start
14
+
15
+ require 'irb'
16
+ require 'irb/completion'
17
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/lib/behavior_tree.rb CHANGED
@@ -1,4 +1,43 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Load all files from lib.
4
- Dir[File.join('./lib', 'behavior_tree', '**', '*.rb')].sort.each { |file| require file }
4
+ # Gem.find_files('behavior_tree/**/*.rb').each { |path| require path }
5
+
6
+ # Dir.glob(File.join('**', '*.rb')).sort.each { |file| require_relative file }
7
+
8
+ # Dir[File.join('.', 'behavior_tree', '**', '*.rb')].sort.each { |file| require_relative file }
9
+
10
+ # pp Dir[File.join('.', 'behavior_tree', '**', '*.rb')]
11
+ # require_relative './behavior_tree/tree'
12
+ puts do
13
+ raise 'haha' if (2 - 1) == 1
14
+
15
+ require_relative './behavior_tree/concerns/tree_structure/printer'
16
+ require_relative './behavior_tree/concerns/tree_structure/algorithms'
17
+ require_relative './behavior_tree/tasks/task_base'
18
+ require_relative './behavior_tree/single_child_node'
19
+ require_relative './behavior_tree/decorator_nodes/decorator_base'
20
+ require_relative './behavior_tree/decorator_nodes/repeater'
21
+ require_relative './behavior_tree/decorator_nodes/retry'
22
+ require_relative './behavior_tree/decorator_nodes/inverter'
23
+ require_relative './behavior_tree/decorator_nodes/force_success'
24
+ require_relative './behavior_tree/decorator_nodes/force_failure'
25
+ require_relative './behavior_tree/decorator_nodes/condition'
26
+ require_relative './behavior_tree/errors'
27
+ require_relative './behavior_tree/control_nodes/control_node_base'
28
+ require_relative './behavior_tree/control_nodes/selector'
29
+ require_relative './behavior_tree/control_nodes/sequence'
30
+ require_relative './behavior_tree/node_status'
31
+ require_relative './behavior_tree/tasks/nop'
32
+ require_relative './behavior_tree/builder'
33
+ require_relative './behavior_tree/version'
34
+ require_relative './behavior_tree/tree'
35
+ end
36
+ # puts "lol?"
37
+ # puts nil
38
+ # puts File.join(__dir__, 'behavior_tree', '**', '*.rb')
39
+ # puts
40
+
41
+ Dir[File.join(__dir__, 'behavior_tree', '**', '*.rb')].sort.each { |file| require_relative file }
42
+ # puts File.expand_path(File.join('lib', 'behavior_tree', '**', '*.rb')).each {|f| puts f}
43
+ # puts "--"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BehaviorTree
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.8'
5
5
  end
data/memo.md ADDED
@@ -0,0 +1,46 @@
1
+ # Memo
2
+
3
+ ## Event-driven trees
4
+
5
+ Implementing conditionals. This can be useful for creating event-driven behavior trees.
6
+
7
+ https://docs.unrealengine.com/4.26/en-US/InteractiveExperiences/ArtificialIntelligence/BehaviorTrees/BehaviorTreesOverview/
8
+
9
+ > In the section of a Behavior Tree above, the Decorators Close Enough and Blackboard can prevent the execution of the Sequence node's children. Another advantage of conditional Decorators is that it is easy to make those Decorators act as observers (waiting for events) at critical nodes in the tree. This feature is critical to gaining full advantage from the event-driven nature of the trees.
10
+
11
+ ## Task-only decorators
12
+
13
+ There might be the need to implement decorators that can only have a task child (as opposed to having a selector/sequence node as a child, etc). How can I implement this? I can probably add just a simple check to make sure the decorator has a task node, but I'd need to think how to make it elegant.
14
+
15
+ ## Rename TaskBase to Task
16
+
17
+ ~~Consider renaming it, because this class will be used by users (programmers), and the name is a bit long.~~
18
+
19
+ ## TODO
20
+
21
+ 1. ~~Mechanism to add new keywords to the DSL. Maybe make it the same way as it is now, by defining a mapping hash, but make it configurable (dynamic). The user can add keywords, and assign a class name.~~
22
+ 2. ~~Way to create new control nodes, and make it easy to pass strategies. So far, strategies are defined in modules, but this makes them hardcoded. So the idea is that it's easier to do. The idea is that selector/sequence logics can be mixed with different strategies. So if the user wants to create a new type of selector, they can start from the normal selector, and add a strategy. This means that the two components of a control node is (1) how it selects/sequences, and (2) children iteration.~~
23
+
24
+ ## Implement an `init` and `process` lifecycle for leaf nodes
25
+
26
+ This seems nice, and not very hard to implement.
27
+
28
+ https://www.gamasutra.com/blogs/ChrisSimpson/20140717/221339/Behavior_trees_for_AI_How_they_work.php
29
+
30
+ > init - Called the first time a node is visited by its parent during its parents execution. For example a sequence will call this when its the node’s turn to be processed. It will not be called again until the next time the parent node is fired after the parent has finished processing and returned a result to its parent. This function is used to initialise the node and start the action the node represents. Using our walk example, it will retrieve the parameters and perhaps initiate the pathfinding job.
31
+ >
32
+ > process - This is called every tick of the behaviour tree while the node is processing. If this function returns Success or Failure, then its processing will end and the result passed to its parent. If it returns Running it will be reprocessed next tick, and again and again until it returns a Success or Failure. In the Walk example, it will return Running until the pathfinding either succeeds or fails.
33
+
34
+ ## Optimization
35
+
36
+ (Regarding traversing entire tree every frame)
37
+
38
+ > This isn’t a very efficient way to do things, especially when the behaviour tree gets deeper as its developed and expanded during development. I’d say its a must that any behaviour tree you implement should store any currently processing nodes so they can be ticked directly within the behaviour tree engine rather than per tick traversal of the entire tree.
39
+
40
+ How can this be incorporated seamlessly without breaking too much into the existing code?
41
+
42
+ ## Document
43
+
44
+ https://guides.rubygems.org/make-your-own-gem/
45
+
46
+ > By default most gems use RDoc to generate docs. There are plenty of great tutorials for learning how to mark up your code with RDoc.
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: behavior_tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felo Vilches
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
11
  date: 2021-07-15 00:00:00.000000000 Z
@@ -24,13 +24,26 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.8.1
27
- description:
27
+ description:
28
28
  email:
29
29
  - felovilches@gmail.com
30
30
  executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
+ - ".gitignore"
35
+ - ".rspec"
36
+ - ".rubocop.yml"
37
+ - ".travis.yml"
38
+ - CODE_OF_CONDUCT.md
39
+ - Gemfile
40
+ - Gemfile.lock
41
+ - LICENSE.txt
42
+ - README.md
43
+ - Rakefile
44
+ - behavior_tree.gemspec
45
+ - bin/console
46
+ - bin/setup
34
47
  - lib/behavior_tree.rb
35
48
  - lib/behavior_tree/builder.rb
36
49
  - lib/behavior_tree/concerns/dsl/dsl.yml
@@ -61,11 +74,12 @@ files:
61
74
  - lib/behavior_tree/tasks/task_base.rb
62
75
  - lib/behavior_tree/tree.rb
63
76
  - lib/behavior_tree/version.rb
77
+ - memo.md
64
78
  homepage: https://github.com/FeloVilches/Ruby-Behavior-Tree
65
79
  licenses:
66
80
  - MIT
67
81
  metadata: {}
68
- post_install_message:
82
+ post_install_message:
69
83
  rdoc_options: []
70
84
  require_paths:
71
85
  - lib
@@ -80,8 +94,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
94
  - !ruby/object:Gem::Version
81
95
  version: '0'
82
96
  requirements: []
83
- rubygems_version: 3.2.3
84
- signing_key:
97
+ rubygems_version: 3.1.2
98
+ signing_key:
85
99
  specification_version: 4
86
100
  summary: Behavior Tree (AI) library for Ruby.
87
101
  test_files: []