MetaGPT/minecraft_run.py

34 lines
967 B
Python
Raw Normal View History

2023-09-24 11:20:45 +08:00
# -*- coding: utf-8 -*-
# @Date : 2023/9/24 11:09
# @Author : stellahong (stellahong@fuzhi.ai)
# @Desc :
import asyncio
from metagpt.roles.minecraft.curriculum_agent import CurriculumDesigner
from metagpt.roles.minecraft.skill_manager import SkillManager
from metagpt.roles.minecraft.action_developer import ActionDeveloper
from metagpt.roles.minecraft.critic_agent import CriticReviewer
from metagpt.minecraft_team import MinecraftPlayer
2023-10-09 19:32:50 +08:00
async def learn(task="Start", investment: float = 50.0, n_round: int = 50):
2023-09-24 11:20:45 +08:00
mc_player = MinecraftPlayer()
2023-10-09 19:32:50 +08:00
mc_player.set_port(30181) # Modify this to your Minecraft LAN port
2023-09-24 11:20:45 +08:00
mc_player.hire(
[
CurriculumDesigner(),
ActionDeveloper(),
2023-10-06 16:37:52 +08:00
CriticReviewer(),
2023-09-24 11:20:45 +08:00
SkillManager(),
]
)
2023-09-24 11:20:45 +08:00
mc_player.invest(investment)
mc_player.start(task)
await mc_player.run(n_round=n_round)
if __name__ == "__main__":
asyncio.run(learn())