From fd4f952a2c90b58445cd2fe863b6a67426315582 Mon Sep 17 00:00:00 2001 From: Ayush Maniar Date: Tue, 25 Feb 2025 22:47:43 -0800 Subject: [PATCH] Added example tasks for different goals per agent --- example_tasks.json | 5 ++++- src/agent/tasks.js | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/example_tasks.json b/example_tasks.json index a1287c2..f90ad7c 100644 --- a/example_tasks.json +++ b/example_tasks.json @@ -148,6 +148,9 @@ ] }, "blocked_access_to_recipe": [], - "goal": "Collaborate to make 1 bread, 1 cooked_mutton" + "goal" : { + "0": "Collaborate with randy to make 1 bread and 1 cooked mutton, you can divide the tasks among yourselves.\nThere is a furnace nearby that is already fueled, there is also a smoker and crafting table nearby, use them to your advantage. Crops of all different types are available in the farm where you are standing, you can use them to your advantage as well. The farm also includes animals like cows, pigs, sheep, and chickens that you can use to your advantage.\nSince the farm is huge, make sure to search for the resources over long distances to find them.", + "1": "Collaborate with andy to make 1 bread and 1 cooked mutton, you can divide the tasks among yourselves.\nThere is a furnace nearby that is already fueled, there is also a smoker and crafting table nearby, use them to your advantage. Crops of all different types are available in the farm where you are standing, you can use them to your advantage as well. The farm also includes animals like cows, pigs, sheep, and chickens that you can use to your advantage.\nSince the farm is huge, make sure to search for the resources over long distances to find them." + } } } \ No newline at end of file diff --git a/src/agent/tasks.js b/src/agent/tasks.js index 770a939..dab9680 100644 --- a/src/agent/tasks.js +++ b/src/agent/tasks.js @@ -155,15 +155,21 @@ export class Task { return null; } + let add_string = ''; + + if (this.task_type === 'cooking') { + add_string = '\nIn the end, all the food should be given to Andy.'; + } + // If goal is a string, all agents share the same goal if (typeof this.data.goal === 'string') { - return this.data.goal; + return this.data.goal + add_string; } // If goal is an object, get the goal for this agent's count_id if (typeof this.data.goal === 'object' && this.data.goal !== null) { const agentId = this.agent.count_id.toString(); - return this.data.goal[agentId] || null; + return (this.data.goal[agentId] || '') + add_string; } return null; @@ -262,6 +268,7 @@ export class Task { } const agentGoal = this.getAgentGoal(); + console.log(`Agent goal for agent Id ${this.agent.count_id}: ${agentGoal}`); if (agentGoal) { console.log(`Setting goal for agent ${this.agent.count_id}: ${agentGoal}`); await executeCommand(this.agent, `!goal("${agentGoal}")`);