"""开发用冒烟测试:12 个 AI(启发式)打一整局,打印过程与结果。""" import asyncio import sys sys.stdout.reconfigure(encoding="utf-8") from app.game.player import Player from app.game.room import Room async def main(): room = Room("TEST", "classic12") for seat in room.free_seats(): name, persona = room.next_ai_name() ai = Player(seat, name, is_ai=True) ai.persona = persona room.players[seat] = ai err = await room.start_game() print("start_game:", repr(err)) if err: return await asyncio.wait_for(room.engine_task, timeout=600) e = room.engine print("\n=== 对局结束 ===") print("winner:", e.winner, "|", e.winner_text) print("总天数:", e.day) print("--- 公开日志 ---") for entry in e.log: if entry["visible"] is None: print(" *", entry["text"]) print("--- 身份 ---") for seat in sorted(room.players): p = room.players[seat] print(f"{seat}号 {p.name}: {p.role.value if p.role else '?'} alive={p.alive}") asyncio.run(main())