Giter Site home page Giter Site logo

Support AI plugins about tenhou-python-bot HOT 6 CLOSED

Nihisil avatar Nihisil commented on June 17, 2024 1
Support AI plugins

from tenhou-python-bot.

Comments (6)

0xrgb avatar 0xrgb commented on June 17, 2024

How about using MJAI protocol to communicate between AI <--> Program? It has some advantages.

  1. There are mahjong AI using MJAI protocol. You can use it, or refer it to make new AI.
  2. Also, you can use maujong AI plugin (Akagi, Sigma, etc) via transmau.
  3. Ruleset of MJAI server and tenhou.net are very similar.
    • You can debug your AI at local MJAI server. (without access to tenhou.net)
  4. Protocol is simple JSON. It is easy to read (+ easy to debug).

And some disadvantages,

  1. There are no English manual.
  2. Source codes and libraries about MJAI are written as in ruby.

from tenhou-python-bot.

mthrok avatar mthrok commented on June 17, 2024

@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.

from tenhou-python-bot.

Nihisil avatar Nihisil commented on June 17, 2024

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.

from tenhou-python-bot.

Nihisil avatar Nihisil commented on June 17, 2024

@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.

from tenhou-python-bot.

Nihisil avatar Nihisil commented on June 17, 2024

This interface contains all available AI methods: https://github.com/MahjongRepository/tenhou-python-bot/blob/master/project/game/ai/base/main.py

from tenhou-python-bot.

Nihisil avatar Nihisil commented on June 17, 2024

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.

from tenhou-python-bot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.