From 0bf58d07c15a52af8e67fd7ed30246931846a50d Mon Sep 17 00:00:00 2001 From: Piotr Spieker Date: Tue, 26 Nov 2024 18:49:57 +0100 Subject: [PATCH] Improve tasks based on review suggestions Co-authored-by: ll-nick <68419636+ll-nick@users.noreply.github.com> --- docs/tasks/1_implement_behavior_component.md | 4 ++-- docs/tasks/4_nested_arbitrators.md | 2 +- docs/tasks/5_cost_arbitration.md | 6 ++++++ docs/tasks/6_verification.md | 3 ++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/tasks/1_implement_behavior_component.md b/docs/tasks/1_implement_behavior_component.md index 3afa421d..ba9ec7f3 100644 --- a/docs/tasks/1_implement_behavior_component.md +++ b/docs/tasks/1_implement_behavior_component.md @@ -19,7 +19,7 @@ That's great and all but if we ate a power pellet, we want to take advantage and To do this, we need to implement the `ChaseGhost` behavior component. It essentially does the exact opposite of the `AvoidGhost` behavior component but is only applicable when Pac-Man ate a power pellet. -We can ensure that's always the case using the behavior's invocation condition. +We can ensure that this is always the case by using the behavior's invocation condition. But wait - the current implementation of the invocation condition is not complete. It should only be applicable if there is one of these tasty ghosts close by. @@ -34,7 +34,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 Pac-Man behaves. -- Run the unit tests and note that the `ChaseGhost` `scheckInvocationConditionFalse` test is failing +- Run the unit tests and note that the `ChaseGhost`'s `checkInvocationConditionFalse` 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. - Implement the missing piece. Take a look at the implementation of `AvoidGhostBehavior::checkInvocationCondition()` if you need inspiration. diff --git a/docs/tasks/4_nested_arbitrators.md b/docs/tasks/4_nested_arbitrators.md index 15407c44..9a8f24b5 100644 --- a/docs/tasks/4_nested_arbitrators.md +++ b/docs/tasks/4_nested_arbitrators.md @@ -9,7 +9,7 @@ Integrate a long-term behavior and add another layer to the arbitration graph. ## Context -We have now implemented a few behavior components and integrated them into the arbitration graph. +We have now implemented a behavior component and integrated it into the arbitration graph. So far, all behavior components are children of the root arbitrator. Let's make things a bit more interesting by adding a long-term behavior component that's also about eating dots. diff --git a/docs/tasks/5_cost_arbitration.md b/docs/tasks/5_cost_arbitration.md index bcbb6c58..610c5708 100644 --- a/docs/tasks/5_cost_arbitration.md +++ b/docs/tasks/5_cost_arbitration.md @@ -76,6 +76,12 @@ Also, include `cost_estimator.hpp`: #include "cost_estimator.hpp" ``` +To keep things tidy and consistent, add an alias definition analogous to the existing ones: + +```cpp +using CostArbitrator = arbitration_graphs::CostArbitrator; +``` + Change the type of the `eatDotsArbitrator_` member in the `PacmanAgent` class to `CostArbitrator` and add an instance of the `CostEstimator`: ```cpp private: diff --git a/docs/tasks/6_verification.md b/docs/tasks/6_verification.md index b3775ac4..805c856b 100644 --- a/docs/tasks/6_verification.md +++ b/docs/tasks/6_verification.md @@ -53,7 +53,8 @@ Add the `MoveRandomly` behavior component as a last resort fallback layer. ## Instructions -- In `verifier.cpp`, finish the implementation of the `Verifier::analyze()` method. +- In `verifier.hpp`, finish the implementation of the `Verifier::analyze()` method. +- Compile and run the unit tests for the `Verifier` to verify that your implementation is correct. - Add an instance of the `Verifier` to the `PacmanAgent` class and initialize it in the constructor. - Pass the `Verifier` instance to the constructors of the arbitrators. (Hint: You'll need to adjust the template parameters of the arbitrators.)