Closed Nihisil closed 7 years ago
How about using MJAI protocol to communicate between AI <--> Program
? It has some advantages.
And some disadvantages,
@0xrgb That does not help.
The point is that AI/AI developer does not need to understand whatever the underlying protocol the game server uses.
Instead, the connector should expose simple and easy-to-understand methods to retrieve the current state of the game.
So the connector should handle communication to server (here I/O with tenhou.ai) and AI should be referring connector to see the current state of the game, and to give a move back to connector.
Thank you for MJAI, I tried to implement my own implementation of mahjong server in earlier versions of the bot, but abandoned this idea because it took too much time to support it.
I think it is a good idea to add another client (https://github.com/MahjongRepository/tenhou-python-bot/blob/master/project/mahjong/client.py) that will work with MJAI (like current client that is working with tenhou).
For AI developer it will mean that he had to run bot with another console attribute and in terms of AI plugin it will be no difference to work with tenhou or MJAI.
Soon I will have time to finish refactoring and do release with 0.3 version which will include stable AI API (it means that current AI will be changed most likely). I think it is had to be done, because people starting to use this bot code to build their own AI.
@0xrgb @mthrok Hi there.
New version 0.3.0 was released and I tried to simplify new AI development as much as I could. All what you need is create a new package inside game.ai
with main.py file that will contains class:
class ImplementationAI(InterfaceAI):
version = 'my ai'
def discard_tile(self, discard_tile):
# your code here
pass
You can find more details here: https://github.com/MahjongRepository/tenhou-python-bot#implement-your-own-ai
Please, let me know if I missed something that will be useful for you.
This interface contains all available AI methods: https://github.com/MahjongRepository/tenhou-python-bot/blob/master/project/game/ai/base/main.py
Meantime I will work on the mjai client integration, because it will allow to run bots locally. If you have any thoughts how to run it (maybe you already have a script how to run mjai) I will be happy to hear them.
Allow to easily integrate new AI (from other developers) to the project. Need to think about some kind of plugins system