mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-08-13 10:45:34 +02:00
Merge branch 'main' of https://github.com/icwhite/mindcraft
This commit is contained in:
commit
cc3c6d8677
3 changed files with 1970 additions and 11 deletions
|
@ -56,8 +56,13 @@ def analyze_json_file(file_path):
|
|||
if 'turns' in data and isinstance(data['turns'], list):
|
||||
for turn in reversed(data['turns']): # Check turns from the end
|
||||
if turn.get('role') == 'system' and isinstance(turn.get('content'), str):
|
||||
if "Task successful ended with code : 2" in turn['content'] or "Task ended with score : 1" in turn["content"] or "Task ended in score: 1" in turn["content"]:
|
||||
code = turn["content"].split(":")[-1].strip()
|
||||
if code in ["2", "1"]: # Check for success codes
|
||||
return True
|
||||
elif 0 < float(code) < 1: # Check for other success indicators
|
||||
return code
|
||||
else:
|
||||
return False
|
||||
return False
|
||||
except FileNotFoundError:
|
||||
print(f"Error: File not found: {file_path}")
|
||||
|
@ -105,7 +110,7 @@ def aggregate_results(local_folders):
|
|||
result = extract_result(folder_path)
|
||||
if result is not None:
|
||||
total += 1
|
||||
successful += int(result)
|
||||
successful += float(result)
|
||||
except Exception as e:
|
||||
print(f"Error processing {folder_name}: {e}")
|
||||
|
||||
|
@ -554,9 +559,9 @@ def delete_server_files(dest_path):
|
|||
print(f"Error deleting server files: {e}")
|
||||
if not os.path.exists(dest_path):
|
||||
print("Server files deleted successfully.")
|
||||
else:
|
||||
print("Error deleting server files.")
|
||||
delete_server_files(dest_path)
|
||||
# else:
|
||||
# print("Error deleting server files.")
|
||||
# delete_server_files(dest_path)
|
||||
|
||||
|
||||
def launch_world(server_path="./server_data/", agent_names=["andy", "jill"], session_name="server", port=55916):
|
||||
|
|
|
@ -47,6 +47,7 @@ export function resetConstructionWorld(bot, blueprint) {
|
|||
export function checkLevelBlueprint(agent, levelNum) {
|
||||
const blueprint = agent.task.blueprint;
|
||||
const bot = agent.bot;
|
||||
try {
|
||||
const result = blueprint.checkLevel(bot, levelNum);
|
||||
if (result.mismatches.length === 0) {
|
||||
return `Level ${levelNum} is correct`;
|
||||
|
@ -54,6 +55,11 @@ export function checkLevelBlueprint(agent, levelNum) {
|
|||
let explanation = blueprint.explainLevelDifference(bot, levelNum);
|
||||
return explanation;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error checking level blueprint:', error);
|
||||
return `Error checking level ${levelNum}: ${error.message}`;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export function checkBlueprint(agent) {
|
||||
|
@ -158,6 +164,9 @@ export class Blueprint {
|
|||
}
|
||||
checkLevel(bot, levelNum) {
|
||||
const levelData = this.data.levels[levelNum];
|
||||
if (!levelData) {
|
||||
throw new Error(`Level ${levelNum} does not exist in the blueprint.`);
|
||||
}
|
||||
const startCoords = levelData.coordinates;
|
||||
const placement = levelData.placement;
|
||||
const mismatches = [];
|
||||
|
|
1945
tasks/crafting_tasks/train_tasks/filtered_train_tasks.json
Normal file
1945
tasks/crafting_tasks/train_tasks/filtered_train_tasks.json
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue