Closed yangboz closed 3 years ago
@yangboz Could you provide more detail about what you’re looking for? The framework provides a bot that implements Monte Carlo tree search, but it is Javascript like the rest of the codebase. The Bots section of the tutorial shows how to get it up and running.
I am trying using MuZero as AI bots's engine ,but the codebase is written with Python, so if possible the boardgame.io's bot compatible with external service?
There’s no out-of-the-box support, but a minimal bot is a class that extends Bot
and implements a play
method, so you can theoretically integrate with any external service:
import { Bot } from 'boardgame.io/ai';
class CustomBot extends Bot {
async play({ G, ctx }, playerID) {
const nextMove = await fetchActionFromService({ G, ctx }, playerID);
return { action: nextMove };
}
}
So if you can find a way to dispatch the request to the service — for example a request to a Python server — and parse its response into a boardgame.io action, that could work.
boardgame.io expects play
to return an object like:
{
action: {
type: 'MAKE_MOVE' || 'GAME_EVENT',
payload: {
type: string,
args: any,
playerID: string,
},
},
}
If you can deploy a bot separately as a client, please try this. https://github.com/boardgameio/boardgame.io/tree/master/python
I’m going to close this for now as I think it has been answered, but please feel free to re-open it if you have any further questions @yangboz.
does any bots support AI customized define by python aliked script?