From 199208bff3b63208d014631993c5b64bfbfa1286 Mon Sep 17 00:00:00 2001 From: Piotr Spieker Date: Wed, 20 Nov 2024 00:08:47 +0100 Subject: [PATCH] Remove Task 3: Even more behavior components --- README.md | 7 +- docs/Tutorial.md | 7 +- docs/tasks/1_implement_behavior_component.md | 5 +- docs/tasks/2_extend_arbitration_graph.md | 2 +- docs/tasks/3_add_more_behaviors.md | 74 -------------------- docs/tasks/4_nested_arbitrators.md | 2 +- 6 files changed, 11 insertions(+), 86 deletions(-) delete mode 100644 docs/tasks/3_add_more_behaviors.md diff --git a/README.md b/README.md index 4eb8883b..967fd0f7 100644 --- a/README.md +++ b/README.md @@ -76,10 +76,9 @@ It's based on this demo and guides you through all important concepts: 0. [Introduction – start here!](./docs/Tutorial.md) 1. [Implement your first behavior component](./docs/tasks/1_implement_behavior_component.md) 2. [Extend the arbitration graph with that behavior](./docs/tasks/2_extend_arbitration_graph.md) -3. [Add even more behavior components](./docs/tasks/3_add_more_behaviors.md) -4. [Learn about nested arbitration graphs](./docs/tasks/4_nested_arbitrators.md) -5. [Arbitrate based on predicted utility](./docs/tasks/5_cost_arbitration.md) -6. [Verify commands and add a fallback strategy](./docs/tasks/6_verification.md) +3. [Learn about nested arbitration graphs](./docs/tasks/4_nested_arbitrators.md) +4. [Arbitrate based on predicted utility](./docs/tasks/5_cost_arbitration.md) +5. [Verify commands and add a fallback strategy](./docs/tasks/6_verification.md) ## Installation diff --git a/docs/Tutorial.md b/docs/Tutorial.md index cefdb410..51e8ca29 100644 --- a/docs/Tutorial.md +++ b/docs/Tutorial.md @@ -131,7 +131,6 @@ With the basics out of the way, let's work through the tasks. 1. [Implement your first behavior component](./tasks/1_implement_behavior_component.md) 2. [Extend the arbitration graph with that behavior](./tasks/2_extend_arbitration_graph.md) -3. [Add even more behavior components](./tasks/3_add_more_behaviors.md) -4. [Learn about nested arbitration graphs](./tasks/4_nested_arbitrators.md) -5. [Arbitrate based on predicted utility](./tasks/5_cost_arbitration.md) -6. [Verify commands and add a fallback strategy](./tasks/6_verification.md) \ No newline at end of file +3. [Learn about nested arbitration graphs](./docs/tasks/4_nested_arbitrators.md) +4. [Arbitrate based on predicted utility](./docs/tasks/5_cost_arbitration.md) +5. [Verify commands and add a fallback strategy](./docs/tasks/6_verification.md) diff --git a/docs/tasks/1_implement_behavior_component.md b/docs/tasks/1_implement_behavior_component.md index 6386c566..dde4812f 100644 --- a/docs/tasks/1_implement_behavior_component.md +++ b/docs/tasks/1_implement_behavior_component.md @@ -13,8 +13,8 @@ Before we start building our arbitration graph, we want to take a closer look in Don't worry, most of the behavior components are already implemented for you but we want to make sure you have an idea of how they work. -With the current state of the arbitration graph, PacMan will just move around randomly until a ghost gets too close. -That's great and all but if we ate a power pellet, we want to chase the ghosts to eat them for extra points. +With the current state of the arbitration graph, PacMan will just move around and eat dots until a ghost gets too close. +That's great and all but if we ate a power pellet, we want to take advantage and chase the ghosts to eat them for extra points! To do this, we need to implement the `ChaseGhost` behavior component. It essentially does the exact opposite of the `AvoidGhost` behavior component @@ -33,6 +33,7 @@ Finish the implementation of the `checkInvocationCondition()` and `getCommand()` ## Instructions +- Build and run the game, take a look at the arbitration graph and observe how PacMan behaves. - Run the unit tests and note that the `ChaseGhost` `scheckInvocationConditionFalse` test is failing - Open the implementation of the `ChaseGhost` behavior component in `src/chase_ghost_behavior.cpp`. - The `checkInvocationCondition()` function is already implemented but does not check for the presence of a ghost. diff --git a/docs/tasks/2_extend_arbitration_graph.md b/docs/tasks/2_extend_arbitration_graph.md index 20d45a0d..891cb4fa 100644 --- a/docs/tasks/2_extend_arbitration_graph.md +++ b/docs/tasks/2_extend_arbitration_graph.md @@ -82,4 +82,4 @@ explicit PacmanAgent(const entt::Game& game) | [Tutorial Home](../Tutorial.md) | -[Next task →](3_add_more_behaviors.md) +[Next task →](4_nested_arbitrators.md) diff --git a/docs/tasks/3_add_more_behaviors.md b/docs/tasks/3_add_more_behaviors.md deleted file mode 100644 index ea5cb470..00000000 --- a/docs/tasks/3_add_more_behaviors.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: "Arbitration Graphs Tutorial" -menu_title: "More Behaviors" ---- - -# Task 3: Even more behavior components - -Integrate the `EatClosestDot` behavior component into the arbitration graph. - -## Context - -So far, we have not looked into a behavior component that handles the most important aspect of the game: eating dots. -So now is a good a time as any to further extend our arbitration graph with the `EatClosestDot` behavior component. - -We don't want to bore you with the details of planning a path through a PacMan maze, so we have already implemented that for you. -You just need to integrate it into the arbitration graph, very similarly to the [previous task](2_extend_arbitration_graph.md). - -We'll keep it simple and just add it as another option to the priority arbitrator. -Arbitration graphs can be nested of course, but we'll save that for the [next task](4_nested_arbitrators.md). - -## Goal - -Integrate the `EatClosestDot` behavior component into the arbitration graph defined in the `PacmanAgent` class. - -## Instructions - -- Integrate the new component just like you did in the [previous task](2_extend_arbitration_graph.md). -- Start the game and see how PacMan stop wandering around aimlessly and starts eating dots. - -## Solution - -
-Click here to expand the solution - -Include the header of the `EatClosestDot` behavior component in `include/demo/pacman_agent.hpp`: -```cpp -#include "eat_closest_dot_behavior.hpp" -``` - -Add the `ChaseGhost` behavior component as a new member of the `PacmanAgent` class: -```cpp -private: - EatClosestDotBehavior::Ptr eatClosestDotBehavior_; -``` - -In the constructor of the `PacmanAgent` class, initialize the `ChaseGhost` behavior component and add it to the priority arbitrator: -```cpp -explicit PacmanAgent(const entt::Game& game) - : parameters_{}, environmentModel_{std::make_shared(game)} { - - avoidGhostBehavior_ = std::make_shared(environmentModel_, parameters_.avoidGhostBehavior); - chaseGhostBehavior_ = std::make_shared(environmentModel_, parameters_.chaseGhostBehavior); - // Initialize the EatClosestDot behavior component - eatClosestDotBehavior_ = std::make_shared(environmentModel_); - moveRandomlyBehavior_ = std::make_shared(parameters_.moveRandomlyBehavior); - - rootArbitrator_ = std::make_shared("Pacman"); - rootArbitrator_->addOption(chaseGhostBehavior_, PriorityArbitrator::Option::Flags::INTERRUPTABLE); - rootArbitrator_->addOption(avoidGhostBehavior_, PriorityArbitrator::Option::Flags::INTERRUPTABLE); - // Add the EatClosestDot behavior component to the priority arbitrator (after the ghost behavior components!) - rootArbitrator_->addOption(eatClosestDotBehavior_, PriorityArbitrator::Option::Flags::INTERRUPTABLE); - rootArbitrator_->addOption(moveRandomlyBehavior_, PriorityArbitrator::Option::Flags::INTERRUPTABLE); -} -``` -
- - - ---- -[← Previous task](2_extend_arbitration_graph.md) -| -[Tutorial Home](../Tutorial.md) -| -[Next task →](4_nested_arbitrators.md) diff --git a/docs/tasks/4_nested_arbitrators.md b/docs/tasks/4_nested_arbitrators.md index 6f12bb57..f4129b8c 100644 --- a/docs/tasks/4_nested_arbitrators.md +++ b/docs/tasks/4_nested_arbitrators.md @@ -90,7 +90,7 @@ explicit PacmanAgent(const entt::Game& game) --- -[← Previous task](3_add_more_behaviors.md) +[← Previous task](2_extend_arbitration_graph.md) | [Tutorial Home](../Tutorial.md) |