mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-07-25 09:25:23 +02:00
reset function and better prompts
This commit is contained in:
parent
9e7ead7e0c
commit
9575437d56
6 changed files with 178 additions and 42 deletions
31
andy.json
31
andy.json
|
@ -12,26 +12,21 @@
|
|||
{"role": "system", "content": "Level 0 is complete"}
|
||||
],
|
||||
[
|
||||
{"role": "assistant", "content": "I've got stone. What about you jack?"},
|
||||
{"role": "assistant", "content": "I have a door and planks. Great we have everything we need from the blueprint. Let's start building!"},
|
||||
{"role": "assistant", "content": "Great! I'll start by placing the stone blocks for level 0. !newAction(\"Place stone blocks for the base level.\")"},
|
||||
{"role": "assistant", "content": "Since the blueprint for level 1 only has stone, I'll start placing those. !newAction(\"Place stone blocks for level 1.\")"},
|
||||
{"role": "system", "content": "Level 2 is complete"},
|
||||
{"role": "assistant", "content": "Great the last level is complete, let's check the whole blueprint just to be sure. !checkBlueprint"}
|
||||
],
|
||||
[
|
||||
{"role": "assistant", "content": "I've got stone. What about you?"},
|
||||
{"role": "assistant", "content": "I have a door and planks. Great we have everything we need from the blueprint. Let's start building the first level! !checkBlueprintLevel(0)"},
|
||||
{"role": "system", "content": "Level 0 requires the following fixes:\n Place stone at X:100, y: -60, Z:-179\n Place stone at X: 99, Y: -60, Z:-179\n Place stone at X: 98, Y:-60, Z:-179..."},
|
||||
{"role": "assistant", "content": "Looks like the first level requires only stone, why don't you build that since you have stone?"},
|
||||
{"role": "assistant", "content": "Ok, let me see what needs to be done for level 0. !checkBlueprintLevel(0) "},
|
||||
{"role": "system", "content": "Level 0 requires the following fixes:\n Place stone at X:100, y: -60, Z:-179\n Place stone at X: 99, Y: -60, Z:-179\n Place stone at X: 98, Y:-60, Z:-179..."},
|
||||
{"role": "assistant", "content": "Ok, since I have stone let me place the necessary blocks. !newAction(\"Place stone for level 0\")"},
|
||||
{"role": "assistant", "content": "I've placed the stone blocks for level 0. Let's check if it is done! !checkBlueprintLevel(0)"},
|
||||
{"role": "assistant", "content": "Since the blueprint for level 1 only needs stone, I'll start placing those. !newAction(\"Place stone blocks for level 1.\")"},
|
||||
{"role": "assistant", "content": "jill: I'll place the planks for level 2. !newAction(\"Place planks for level 2.\")"}
|
||||
],
|
||||
[
|
||||
{"role": "assistant", "content": "I've got some oak planks for level 2. Let's start building the base with stone. Since I don't have stone, could you help out? "},
|
||||
{"role": "assistant", "content": "For sure! I will build levels 0 and 1 with stone and let you know when I am done. !newAction(\"Place stone blocks for levels 0 and 1 \")"},
|
||||
{"role": "assistant", "content": "I've placed the stone blocks for levels 0 and 1. Your turn!"},
|
||||
{"role": "assistant", "content": "I'll start placing the planks for level 2. !newAction(\"Place plank blocks for level 2\")"}
|
||||
],
|
||||
[
|
||||
{"role": "assistant", "content": "Looks like level 0 requires stone, since I only have oak planks and no stone, I will let you build that. Let me know when you are done!"},
|
||||
{"role": "assistant", "content": "Ok, placing for level 0 at the specified coordinates now !newAction(\"Place stone blocks for level 0\")"},
|
||||
{"role": "assistant", "content": "Looks like level 1 requires stone, since I only have oak planks and no stone, I will let you build that. Let me know when you are done!"},
|
||||
{"role": "assistant", "content": "I've placed the planks for level 1. Your turn!"},
|
||||
{"role": "assistant", "content": "Great work! I'll start placing the planks for level 2. !newAction(\"Place plank blocks for level 2\")"}
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
}
|
|
@ -109,8 +109,8 @@
|
|||
},
|
||||
"multiagent_construction_house": {
|
||||
"type": "construction",
|
||||
"goal": "Make a house with the blueprint above, tell the other agents what materials you have and share them to finish the blueprint. You and the other agent have all the necessary materials for the blueprint at this point. ",
|
||||
"conversation": "Let's share materials and make a house with this blueprint. You and the other agent have all materials necessary at this point:",
|
||||
"goal": "Make a house with the blueprint below ",
|
||||
"conversation": "Let's share materials and make a house with the blueprint",
|
||||
"agent_count": 2,
|
||||
"blueprint": {
|
||||
"materials": {
|
||||
|
@ -164,10 +164,105 @@
|
|||
"oak_planks": 20
|
||||
},
|
||||
"1": {
|
||||
"oak_door": 1,
|
||||
"stone": 26
|
||||
"stone": 40,
|
||||
"oak_door": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"construction_large_house": {
|
||||
"type": "construction",
|
||||
"goal": "Make a large house with the blueprint below ",
|
||||
"agent_count": 1,
|
||||
"blueprint": {
|
||||
"materials": {
|
||||
"bricks": {
|
||||
"id": "bricks",
|
||||
"number": 200
|
||||
},
|
||||
"glass_pane": {
|
||||
"id": "glass_pane",
|
||||
"number": 24
|
||||
},
|
||||
"oak_door": {
|
||||
"id": "oak_door",
|
||||
"number": 2
|
||||
}
|
||||
},
|
||||
"levels": [
|
||||
{
|
||||
"level": 0,
|
||||
"coordinates": [162, -60, -180],
|
||||
"placement":
|
||||
[
|
||||
["bricks", "bricks", "bricks", "bricks", "dark_oak_door", "dark_oak_door", "bricks", "bricks", "bricks", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "bricks", "bricks", "bricks", "bricks", "bricks", "bricks", "bricks", "bricks", "bricks"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"level": 1,
|
||||
"coordinates": [162, -59, -180],
|
||||
"placement":
|
||||
[
|
||||
["bricks", "glass_pane", "glass_pane", "bricks", "dark_oak_door", "dark_oak_door", "bricks", "glass_pane", "glass_pane", "bricks"],
|
||||
["glass_pane", "air", "air", "air", "air", "air", "air", "air", "air", "glass_pane"],
|
||||
["glass_pane", "air", "air", "air", "air", "air", "air", "air", "air", "glass_pane"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["glass_pane", "air", "air", "air", "air", "air", "air", "air", "air", "glass_pane"],
|
||||
["glass_pane", "air", "air", "air", "air", "air", "air", "air", "air", "glass_pane"],
|
||||
["bricks", "bricks", "bricks", "bricks", "bricks", "bricks", "bricks", "bricks", "bricks", "bricks"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"level": 2,
|
||||
"coordinates": [162, -58, -180],
|
||||
"placement":
|
||||
[
|
||||
["bricks", "glass_pane", "glass_pane", "bricks", "air", "air", "bricks", "glass_pane", "glass_pane", "bricks"],
|
||||
["glass_pane", "air", "air", "air", "air", "air", "air", "air", "air", "glass_pane"],
|
||||
["glass_pane", "air", "air", "air", "air", "air", "air", "air", "air", "glass_pane"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["glass_pane", "air", "air", "air", "air", "air", "air", "air", "air", "glass_pane"],
|
||||
["glass_pane", "air", "air", "air", "air", "air", "air", "air", "air", "glass_pane"],
|
||||
["bricks", "bricks", "bricks", "bricks", "bricks", "bricks", "bricks", "bricks", "bricks", "bricks"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"level": 3,
|
||||
"coordinates": [162, -57, -180],
|
||||
"placement":
|
||||
[
|
||||
["bricks", "bricks", "bricks", "bricks", "bricks", "bricks", "bricks", "bricks", "bricks", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "air", "air", "air", "air", "air", "air", "air", "air", "bricks"],
|
||||
["bricks", "bricks", "bricks", "bricks", "bricks", "bricks", "bricks", "bricks", "bricks", "bricks"]
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"initial_inventory": {
|
||||
"bricks": 200,
|
||||
"dark_oak_door": 2,
|
||||
"glass_pane": 24
|
||||
}
|
||||
}
|
||||
|
||||
}
|
41
jill.json
41
jill.json
|
@ -1,29 +1,34 @@
|
|||
{
|
||||
"name": "jill",
|
||||
|
||||
"model": "gpt-4o",
|
||||
"model": "gpt-4o",
|
||||
|
||||
"conversation_examples": [
|
||||
[
|
||||
{"role": "assistant", "content": " I've got stone. What about you jack?"},
|
||||
{"role": "assistant", "content": "I have a door and planks. Great we have everything we need from the blueprint. Let's start building!"},
|
||||
{"role": "assistant", "content": "Great! I'll start by placing the stone blocks for level 0. !newAction(\"Place stone blocks for the base level.\")"},
|
||||
{"role": "assistant", "content": "Since the blueprint for level 1 only has stone, I'll start placing those. !newAction(\"Place stone blocks for level 1.\")"},
|
||||
{"role": "assistant", "content": "Alright I have the necessary materials to build, what needs to be done for the first level of the blueprint? !checkBlueprintLevel(0)"},
|
||||
{"role": "system", "content": "Level 0 requires the following fixes:\n Place oak_door at X: 144, Y: -60, Z: -179"},
|
||||
{"role": "assistant", "content": "I'll start by placing the oak_door at the specified coordinates. !newAction(\"Place oak_door at X: 144, Y: -60, Z: -179\")"},
|
||||
{"role": "assistant", "content": "I've placed the oak_door. What's next? !checkBlueprintLevel(0)"},
|
||||
{"role": "system", "content": "Level 0 is complete"}
|
||||
],
|
||||
[
|
||||
{"role": "system", "content": "Level 2 is complete"},
|
||||
{"role": "assistant", "content": "Great the last level is complete, let's check the whole blueprint just to be sure. !checkBlueprint"}
|
||||
],
|
||||
[
|
||||
{"role": "assistant", "content": "I've got stone. What about you?"},
|
||||
{"role": "assistant", "content": "I have a door and planks. Great we have everything we need from the blueprint. Let's start building the first level! !checkBlueprintLevel(0)"},
|
||||
{"role": "system", "content": "Level 0 requires the following fixes:\n Place stone at X:100, y: -60, Z:-179\n Place stone at X: 99, Y: -60, Z:-179\n Place stone at X: 98, Y:-60, Z:-179..."},
|
||||
{"role": "assistant", "content": "Looks like the first level requires only stone, why don't you build that since you have stone?"},
|
||||
{"role": "assistant", "content": "Ok, let me see what needs to be done for level 0. !checkBlueprintLevel(0) "},
|
||||
{"role": "system", "content": "Level 0 requires the following fixes:\n Place stone at X:100, y: -60, Z:-179\n Place stone at X: 99, Y: -60, Z:-179\n Place stone at X: 98, Y:-60, Z:-179..."},
|
||||
{"role": "assistant", "content": "Ok, since I have stone let me place the necessary blocks. !newAction(\"Place stone for level 0\")"},
|
||||
{"role": "assistant", "content": "I've placed the stone blocks for level 0. Let's check if it is done! !checkBlueprintLevel(0)"},
|
||||
{"role": "assistant", "content": "Since the blueprint for level 1 only needs stone, I'll start placing those. !newAction(\"Place stone blocks for level 1.\")"},
|
||||
{"role": "assistant", "content": "jill: I'll place the planks for level 2. !newAction(\"Place planks for level 2.\")"}
|
||||
],
|
||||
[
|
||||
{"role": "assistant", "content": "I've got some oak planks for level 2. Let's start building the base with stone. Since I don't have stone, could you help out? "},
|
||||
{"role": "assistant", "content": "For sure! I will build levels 0 and 1 with stone and let you know when I am done. !newAction(\"Place stone blocks for levels 0 and 1 \")"},
|
||||
{"role": "assistant", "content": "I've placed the stone blocks for levels 0 and 1. Your turn!"},
|
||||
{"role": "assistant", "content": "I'll start placing the planks for level 2. !newAction(\"Place plank blocks for level 2\")"}
|
||||
],
|
||||
[
|
||||
{"role": "assistant", "content": "Looks like level 0 requires stone, since I only have oak planks and no stone, I will let you build that. Let me know when you are done!"},
|
||||
{"role": "assistant", "content": "Ok, placing for level 0 at the specified coordinates now !newAction(\"Place stone blocks for level 0\")"},
|
||||
{"role": "assistant", "content": "Looks like level 1 requires stone, since I only have oak planks and no stone, I will let you build that. Let me know when you are done!"},
|
||||
{"role": "assistant", "content": "I've placed the planks for level 1. Your turn!"},
|
||||
{"role": "assistant", "content": "Great work! I'll start placing the planks for level 2. !newAction(\"Place plank blocks for level 2\")"}
|
||||
]
|
||||
|
||||
|
||||
]
|
||||
|
||||
}
|
|
@ -12,7 +12,7 @@ export default
|
|||
|
||||
"profiles": [
|
||||
"./andy.json",
|
||||
// "./jill.json",
|
||||
"./jill.json"
|
||||
// "./profiles/gpt.json",
|
||||
// "./profiles/claude.json",
|
||||
// "./profiles/gemini.json",
|
||||
|
|
|
@ -65,6 +65,28 @@ export class ConstructionTaskValidator {
|
|||
}
|
||||
}
|
||||
|
||||
export function resetConstructionWorld(bot, blueprint) {
|
||||
console.log('Resetting world...');
|
||||
const starting_position = blueprint.levels[0].coordinates;
|
||||
const length = blueprint.levels[0].placement.length + 5;
|
||||
const height = blueprint.levels.length + 5;
|
||||
const width = blueprint.levels[0].placement[0].length + 5;
|
||||
const command = `/fill ${starting_position[0]} ${starting_position[1]} ${starting_position[2]} ${starting_position[0] + width} ${starting_position[1] + height} ${starting_position[2] + length} air`;
|
||||
bot.chat(command);
|
||||
console.log('World reset');
|
||||
}
|
||||
|
||||
// export function resetConstructionWorld(bot) {
|
||||
// console.log('Resetting world...');
|
||||
// const pos = getPosition(bot);
|
||||
// const xOffset = 25;
|
||||
// const zOffset = 25;
|
||||
// const command = `/fill ${Math.floor(pos.x - xOffset)} -60 ${Math.floor(pos.z - zOffset)} ${Math.floor(pos.x + xOffset)} -50 ${Math.floor(pos.z + zOffset)} air`;
|
||||
// console.log('Command:', command);
|
||||
// bot.chat(command);
|
||||
// console.log('World reset');
|
||||
// }
|
||||
|
||||
export function checkLevelBlueprint(agent, levelNum) {
|
||||
const blueprint = agent.task.blueprint;
|
||||
const bot = agent.bot;
|
||||
|
@ -219,6 +241,8 @@ export class Blueprint {
|
|||
"matches": matches
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
export class Task {
|
||||
|
@ -228,6 +252,7 @@ export class Task {
|
|||
this.taskTimeout = 300;
|
||||
this.taskStartTime = Date.now();
|
||||
this.validator = null;
|
||||
this.reset_function = null;
|
||||
this.blocked_actions = [];
|
||||
if (task_path && task_id) {
|
||||
this.data = this.loadTask(task_path, task_id);
|
||||
|
@ -294,6 +319,8 @@ export class Task {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
async initBotTask() {
|
||||
if (this.data === null)
|
||||
return;
|
||||
|
|
14
test/test_reset.js
Normal file
14
test/test_reset.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { resetConstructionWorld } from "../src/agent/tasks.js";
|
||||
import mineflayer from 'mineflayer';
|
||||
|
||||
const bot = mineflayer.createBot({
|
||||
host: 'localhost', // Replace with your server IP or hostname
|
||||
port: 55916, // Replace with your server port
|
||||
username: 'andy', // Replace with your bot's username
|
||||
// password: 'your_bot_password' // Only if the server has online-mode=true
|
||||
});
|
||||
|
||||
bot.on('spawn', async () => {
|
||||
bot.chat("/tp andy izzycw");
|
||||
resetConstructionWorld(bot);
|
||||
});
|
Loading…
Add table
Reference in a new issue