ArcherArcher
Home
Quick Start
Project Introduction
  • 简体中文
  • English
Home
Quick Start
Project Introduction
  • 简体中文
  • English
  • Home
  • Basic Configuration

    • Project Introduction
    • Quick Start
    • FAQ
    • Contact Us
  • Advanced Development

    • Basic Knowledge
    • Basic Framework
    • Majsoul Development

      • Tile Names

        • Basic
      • Manager

        • Lobby Manager
      • Game Interfaces

        • Basic
      • LQ

        • Basic
      • Action Types

        • Basic
      • Game State

        • Basic
      • Login Event

        • Login Event
        • Advanced - Mahjong Event Login
      • Discard Actions

        • Basics
        • Advanced
      • Chii (Eat)
      • Pon
      • Kong
      • Cancel, Skip
  • Plugin System

    • Basic Usage
    • Resource Plugin Development
  • Auto Review

    • Automatic Review
  • Tenhou Room

    • Playing in Tenhou Private Room with Mortal Bot

Calling the Interface

  • Use the corresponding method from the MajsoulActions package to perform a Kong.

Example Code

package main

import (
  "github.com/moxcomic/Archer/actions"
  "github.com/moxcomic/lq"
)

const (
  E_PlayOperation_None           = iota
  E_PlayOperation_Discard
  E_PlayOperation_Chi
  E_PlayOperation_Pon
  E_PlayOperation_Ankan
  E_PlayOperation_Minkan
  E_PlayOperation_Kakan
  E_PlayOperation_RiiChi
  E_PlayOperation_Tsumo
  E_PlayOperation_Ron
  E_PlayOperation_JiuZhongJiuPai
  E_PlayOperation_Babei
  E_PlayOperation_HuanSanZhang
  E_PlayOperation_DingQue
  E_PlayOperation_Reveal
  E_PlayOperation_Unveil
  E_PlayOperation_LockTile
  E_PlayOperation_Revealliqi
)

func onExecute(result *lq.NotifyAIResult, risk []float64, r, m, f, t float64) {
  if result.GetResult()[0].GetType() == E_PlayOperation_Minkan {
    actions.NewMajsoulActions().Daimingkan(result.GetResult()[0].GetCombination()[0])
  }

  if result.GetResult()[0].GetType() == E_PlayOperation_Kakan {
    actions.NewMajsoulActions().Kakan(result.GetResult()[0].GetCombination()[0])
  }

  if result.GetResult()[0].GetType() == E_PlayOperation_Ankan {
    actions.NewMajsoulActions().Ankan(result.GetResult()[0].GetCombination()[0])
  }
}
  • Call the Daimingkan method to perform a Melded Kong.
  • Call the Kakan method to perform a Supplemental Kong.
  • Call the Ankan method to perform a Concealed Kong.
  • All three methods require a Combination type parameter, representing the tile being acted upon.
  • In the example code, we use the GetResult method to retrieve the AI's action result and perform the corresponding operation based on the action type.
  • This is just an example. In actual usage, you may need to modify the code according to real-world scenarios.
  • For more on lq.NotifyAIResult, refer to NotifyAIResult.
  • For GetType, refer to Action Types.
Prev
Pon
Next
Cancel, Skip