mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-09-09 11:33:02 +02:00
adding the blueprint to the goal string
This commit is contained in:
parent
d2f46dbe65
commit
095cdc2d6d
2 changed files with 22 additions and 9 deletions
|
@ -27,7 +27,7 @@
|
||||||
"techtree_1_shears_with_2_iron_ingot": {
|
"techtree_1_shears_with_2_iron_ingot": {
|
||||||
"goal": "Build a shear.",
|
"goal": "Build a shear.",
|
||||||
"initial_inventory": {
|
"initial_inventory": {
|
||||||
"iron_ingot": 1
|
"iron_ingot": 2
|
||||||
},
|
},
|
||||||
"target": "shears",
|
"target": "shears",
|
||||||
"number_of_target": 1,
|
"number_of_target": 1,
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
},
|
},
|
||||||
"construction_house": {
|
"construction_house": {
|
||||||
"type": "construction",
|
"type": "construction",
|
||||||
"goal": "Make a house with a blueprint below",
|
"goal": "Make a house with the blueprint below",
|
||||||
"blueprint": {
|
"blueprint": {
|
||||||
"materials": {
|
"materials": {
|
||||||
"plank": {
|
"plank": {
|
||||||
|
@ -93,8 +93,8 @@
|
||||||
"placement":
|
"placement":
|
||||||
[
|
[
|
||||||
["plank", "plank", "plank", "plank", "plank"],
|
["plank", "plank", "plank", "plank", "plank"],
|
||||||
["plank", "air", "air", "air", "plank"],
|
["plank", "plank", "plank", "plank", "plank"],
|
||||||
["plank", "air", "air", "air", "plank"],
|
["plank", "plank", "plank", "plank", "plank"],
|
||||||
["plank", "plank", "plank", "plank", "plank"]
|
["plank", "plank", "plank", "plank", "plank"]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,6 @@ export class Blueprint {
|
||||||
}
|
}
|
||||||
return explanation;
|
return explanation;
|
||||||
}
|
}
|
||||||
|
|
||||||
_getPlacementString(placement) {
|
_getPlacementString(placement) {
|
||||||
var placement_string = "[\n";
|
var placement_string = "[\n";
|
||||||
for (let row of placement) {
|
for (let row of placement) {
|
||||||
|
@ -67,7 +66,6 @@ export class Blueprint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export class Task {
|
export class Task {
|
||||||
constructor(agent, task_path, task_id) {
|
constructor(agent, task_path, task_id) {
|
||||||
this.agent = agent;
|
this.agent = agent;
|
||||||
|
@ -78,11 +76,25 @@ export class Task {
|
||||||
this.blocked_actions = [];
|
this.blocked_actions = [];
|
||||||
if (task_path && task_id) {
|
if (task_path && task_id) {
|
||||||
this.data = this.loadTask(task_path, task_id);
|
this.data = this.loadTask(task_path, task_id);
|
||||||
|
this.task_type = this.data.type;
|
||||||
|
console.log('Task type:', this.task_type);
|
||||||
|
if (this.task_type === 'construction' && this.data.blueprint) {
|
||||||
|
//add the blueprint to the goal if it is a construction task
|
||||||
|
//todo: fix this for multi-agent scenarios with partial blueprints
|
||||||
|
this.blueprint = new Blueprint(this.data.blueprint);
|
||||||
|
console.log('Blueprint:', this.blueprint.explain());
|
||||||
|
this.goal = this.data.goal + ' \n' + this.blueprint.explain();
|
||||||
|
console.log('Goal:', this.goal);
|
||||||
|
} else {
|
||||||
|
this.goal = this.data.goal;
|
||||||
|
console.log('Goal:', this.goal);
|
||||||
|
}
|
||||||
|
|
||||||
this.taskTimeout = this.data.timeout || 300;
|
this.taskTimeout = this.data.timeout || 300;
|
||||||
this.taskStartTime = Date.now();
|
this.taskStartTime = Date.now();
|
||||||
this.validator = new TaskValidator(this.data, this.agent);
|
this.validator = new TaskValidator(this.data, this.agent);
|
||||||
this.blocked_actions = this.data.blocked_actions || [];
|
this.blocked_actions = this.data.blocked_actions || [];
|
||||||
if (this.data.goal)
|
if (this.goal)
|
||||||
this.blocked_actions.push('!endGoal');
|
this.blocked_actions.push('!endGoal');
|
||||||
if (this.data.conversation)
|
if (this.data.conversation)
|
||||||
this.blocked_actions.push('!endConversation');
|
this.blocked_actions.push('!endConversation');
|
||||||
|
@ -214,8 +226,9 @@ export class Task {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.data.goal) {
|
if (this.goal) {
|
||||||
await executeCommand(this.agent, `!goal("${this.data.goal}")`);
|
console.log('Setting goal:', this.goal);
|
||||||
|
await executeCommand(this.agent, `!goal("${this.goal}")`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.data.conversation && this.agent.count_id === 0) {
|
if (this.data.conversation && this.agent.count_id === 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue