Archer

调用接口

示例代码

main.go go
package main

import (
  "github.com/moxcomic/Archer/internal/platform/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])
  }
}
  • 调用 Daimingkan 方法进行 明杠 操作。
  • 调用 Kakan 方法进行 加杠 操作。
  • 调用 Ankan 方法进行 暗杠 操作。
  • 以上三个方法均需要传入 Combination 类型参数,该参数代表了被操作的牌。
  • 示例代码中,我们通过 GetResult 方法获取了 AI 的出牌结果,并根据其类型进行相应的操作。
  • 当然这里只是一个示例,实际使用时,你可能需要根据实际情况来修改代码。
  • lq.NotifyAIResult 参考 NotifyAIResult
  • GetType 参考 动作类型