tools

package
v0.0.0-...-dbbf0a6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MSResult = map[string]string{}

Functions

func AESDecrypt

func AESDecrypt(encryptedText string) (string, error)

func AESEncrypt

func AESEncrypt(plainText string) (string, error)

func CacheTest

func CacheTest()

func CheckLikeByResult

func CheckLikeByResult(resultList string, startNum int, campus float64) (int, error)

检索相似度 并给出推荐结果

func GenerateRandomCode

func GenerateRandomCode(length int) (string, error)

GenerateRandomCode 生成指定长度的随机字符码

func GenerateRandomCodeLength

func GenerateRandomCodeLength(length int) string

func GetUUID

func GetUUID() string

func Init

func Init()

func MsResultInit

func MsResultInit()

读取文件 保存结果历史

func PROlist

func PROlist(pro Probabilities) []string

func UserToken

func UserToken(db *gorm.DB, r *http.Request) (*model.User, error)

Types

type BetRecommendation

type BetRecommendation struct {
	Banker int `json:"banker"`
	Player int `json:"player"`
	Tie    int `json:"tie"`
}

type CacheService

type CacheService struct {
	// contains filtered or unexported fields
}

CacheService 定义了一个通用的缓存接口

func NewCache

func NewCache() *CacheService

func NewCacheService

func NewCacheService(defaultExpiration, cleanupInterval time.Duration) *CacheService

NewCacheService 创建一个新的缓存服务实例

func (*CacheService) GetCache

func (cs *CacheService) GetCache(key string) (model.EVPredictive, bool)

GetCache 获取缓存值

func (*CacheService) SetCache

func (cs *CacheService) SetCache(key string, value model.EVPredictive)

SetCache 设置缓存值

type CardEV

type CardEV struct {
	CardA int
	CardB int
	CardC int
	CardD int
	CardE int
	CardF int
	Win   int
}

type ChangeMode4Resp

type ChangeMode4Resp struct {
	Code int `json:"code"`
	Data []struct {
		GameType string `json:"game_type"`
		Tables   []struct {
			Room     string `json:"room"`
			Strategy int    `json:"strategy"`
			Table    int    `json:"table"`
		} `json:"tables"`
	} `json:"data"`
}

type ChangeModeResp

type ChangeModeResp struct {
	RoomName string `json:"room_name"`
	EvType   int    `json:"ev_type"`
	SortNum  int    `json:"sort_num"`
}

func ChangeMode4

func ChangeMode4(gameType string) []ChangeModeResp

type Deck

type Deck struct {
	Cards []int
}

func NewDeck

func NewDeck(puker *string) *Deck

func (*Deck) DrawCard

func (d *Deck) DrawCard() int

func (*Deck) Shuffle

func (d *Deck) Shuffle()

type DigitalPad

type DigitalPad struct {
	// contains filtered or unexported fields
}

DigitalPad represents the digital scoreboard that displays game statistics.

func (*DigitalPad) EnterResults

func (d *DigitalPad) EnterResults(result string)

EnterResults saves the reults of the hand after bets have been paid out.

type EVBase

type EVBase struct {
	Key   string  `json:"key"`
	Value float64 `json:"value"`
}

type EVPResponse

type EVPResponse struct {
	Code        int             `json:"code"` // 0:成功 1:失败
	Msg         string          `json:"msg"`  // 提示信息
	Predictive  int             `json:"predictive"`
	BetAmount   decimal.Decimal `json:"bet_amount"`
	EVList      string          `json:"ev_list"`
	Probability string          `json:"probability"`
}

func SwMaster

func SwMaster(history *model.MSGameHistory, url string) (*EVPResponse, error)

func WqwMaster

func WqwMaster(history *model.MSGameHistory, url string) (*EVPResponse, error)

type EvValues

type EvValues struct {
	BankerEv float64 `json:"banker_ev"`
	PlayerEv float64 `json:"player_ev"`
}

type GameCardEVRequest

type GameCardEVRequest struct {
	EVType    int     `json:"ev_type"`   //1. EV值大的;2. EV值大,而且概率差距大于1.47
	ZP        float64 `json:"zp"`        //庄赢的赔率 1.95
	XP        float64 `json:"xp"`        //闲赢的赔率 2
	HP        float64 `json:"hp"`        //和牌的赔率 9
	DP        float64 `json:"dp"`        //发牌对子的赔率 11
	FR        float64 `json:"fr"`        //反水的赔率 0.01
	PN        int     `json:"pn"`        //当局一共多少副牌 8
	XDZP      float64 `json:"xdzp"`      //闲对子的赔率
	ZDZP      float64 `json:"zdzp"`      //庄对子的赔率
	DZP       float64 `json:"dzp"`       //庄对子的赔率
	SP        float64 `json:"sp"`        //小牌的赔率
	BP        float64 `json:"bp"`        //大牌的赔率
	Condition string  `json:"condition"` //已出卡牌列表 逗号分隔 1,2,10,3...
}

type Hand

type Hand struct {
	Cards []int
}

func (*Hand) AddCard

func (h *Hand) AddCard(card int)

func (*Hand) IsNatural

func (h *Hand) IsNatural() bool

func (*Hand) Total

func (h *Hand) Total() int

type History

type History struct {
	Id          uint      `gorm:"column:id" json:"id"`
	CreatedAt   time.Time `gorm:"column:created_at" json:"created_at"`
	UpdatedAt   time.Time `gorm:"column:updated_at" json:"updated_at"`
	GameUuid    string    `gorm:"column:game_uuid" json:"game_uuid"`
	Pukes       string    `gorm:"column:pukes" json:"pukes"`
	Result      string    `gorm:"column:result" json:"result"`
	ZNum        uint      `gorm:"column:z_num" json:"z_num"`
	XNum        uint      `gorm:"column:x_num" json:"x_num"`
	FileUrl     string    `gorm:"column:file_url" json:"file_url"`
	Sort        int       `gorm:"column:sort" json:"sort"`
	Isev        int       `gorm:"column:isev" json:"isev"`
	Dz          int       `gorm:"column:dz" json:"dz"`
	Zdz         int       `gorm:"column:zdz" json:"zdz"`
	Xdz         int       `gorm:"column:xdz" json:"xdz"`
	SmallAndBig int       `gorm:"column:small_and_big" json:"small_and_big"`
	ZPukes      string    `gorm:"column:z_pukes" json:"z_pukes"`
	XPukes      string    `gorm:"column:x_pukes" json:"x_pukes"`
	RoomName    string    `gorm:"column:room_name" json:"room_name"`
	CardList    string    `gorm:"column:card_list" json:"card_list"`
	GameFrom    string    `gorm:"column:game_from" json:"game_from"`
	GameType    string    `gorm:"column:game_type" json:"game_type"`
	BeforeId    int       `gorm:"column:before_id" json:"before_id"`
	ResultList  string    `gorm:"column:result_list" json:"result_list"`
}

type JiuXiaoResponse

type JiuXiaoResponse struct {
	Predictive int `json:"predictive"` //1庄 2闲 3和
}

func JiuXiao92

func JiuXiao92(history *model.MSGameHistory) (*JiuXiaoResponse, error)

type NewEVLogicResponse

type NewEVLogicResponse struct {
	Prob            []EVBase `json:"prob"`            //概率
	EV              []EVBase `json:"ev"`              //EV值
	RecommendResult int      `json:"recommendResult"` //推荐的结果 0-不推荐 1-闲赢 2-庄赢 3-和牌
}

func NewEvLogic

func NewEvLogic(req *GameCardEVRequest) (resp *NewEVLogicResponse, err error)

NewEvLogic ev预测 新的ev

type Probabilities

type Probabilities struct {
	Banker float64 `json:"banker"`
	Player float64 `json:"player"`
	Tie    float64 `json:"tie"`
}

type ProbabilitiesPah

type ProbabilitiesPah struct {
	BankerWin float64 `json:"banker_win"`
	PlayerWin float64 `json:"player_win"`
	Tie       float64 `json:"tie"`
}

type SWEV5030Resp

type SWEV5030Resp struct {
	PredictedResult string `json:"predicted_result"`
	RoomName        string `json:"room_name"`
}

func SWEV5030

func SWEV5030() ([]SWEV5030Resp, error)

type SWEV5031Resp

type SWEV5031Resp struct {
	Pre      string `json:"Pre"`
	RoomName string `json:"room_name"`
}

func SWEV5031

func SWEV5031() ([]SWEV5031Resp, error)

type SWEV5036Resp

type SWEV5036Resp struct {
	Pre       string `json:"Pre"`
	BetAmount int    `json:"bet_amount"`
	RoomName  string `json:"room_name"`
}

策略94

func SWEV5036

func SWEV5036() ([]SWEV5036Resp, error)

type SWEV5038Req

type SWEV5038Req struct {
	CreatedAt string   `json:"created_at"`
	GameUuid  string   `json:"game_uuid"`
	RoomName  string   `json:"room_name"`
	CardList  []string `json:"card_list"`
	GameType  string   `json:"game_type"`
	Sort      int      `json:"sort"`
}

type SWEV5038Resp

type SWEV5038Resp struct {
	BetRecommendation BetRecommendation `json:"bet_recommendation"`
	EvValues          EvValues          `json:"ev_values"`
	GameInfo          struct {
		CardsPlayed int    `json:"cards_played"`
		CreatedAt   string `json:"created_at"`
		GameType    string `json:"game_type"`
		GameUuid    string `json:"game_uuid"`
		RoomName    string `json:"room_name"`
		Sort        int    `json:"sort"`
	} `json:"game_info"`
	Probabilities  ProbabilitiesPah `json:"probabilities"`
	RemainingCards struct {
		Field1  int `json:"0"`
		Field2  int `json:"1"`
		Field3  int `json:"2"`
		Field4  int `json:"3"`
		Field5  int `json:"4"`
		Field6  int `json:"5"`
		Field7  int `json:"6"`
		Field8  int `json:"7"`
		Field9  int `json:"8"`
		Field10 int `json:"9"`
	} `json:"remaining_cards"`
	Summary string `json:"summary"`
}

func SWEV77

func SWEV77(history *model.MSGameHistory) (*SWEV5038Resp, error)

func SWEV5038

func SWEV5038(history *model.MSGameHistory) (*SWEV5038Resp, error)

type SWRespNew

type SWRespNew struct {
	Prediction    string `json:"prediction"`
	Probabilities Probabilities
}

func SWEV5024

func SWEV5024() (SWRespNew, error)

func SWEV5025

func SWEV5025() (SWRespNew, error)

func SWEV5029

func SWEV5029() (SWRespNew, error)

type SuanfaResp

type SuanfaResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		Predictive  int    `json:"predictive"`
		Probability string `json:"probability"`
	} `json:"data"`
}

func TomSuanfa

func TomSuanfa(history *model.MSGameHistory, evType int) (*SuanfaResp, error)

type TomSuanfaReq

type TomSuanfaReq struct {
	History string `json:"history"`
	EVType  int    `json:"evType"`
}

type WTRequest

type WTRequest struct {
	History *History `json:"history"` //上一局的数据
	EvType  int      `json:"evType"`  //策略ID
}

type WTResponse

type WTResponse struct {
	Predictive int    `json:"predictive"`
	Status     string `json:"status"`
}

func WT91

func WT91(param *model.MSGameHistory, evType int) (*WTResponse, error)

闻涛的算法-evtype 90

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL