40 lines
1.4 KiB
Go
40 lines
1.4 KiB
Go
package stub
|
||
|
||
type ClubRobotConfig struct {
|
||
Id int `json:"id"` // 配置ID
|
||
RoomBlind int `json:"b"` // 对应房间底注
|
||
RoomPlayType int `json:"p"` // 对应房间玩法ID
|
||
|
||
RobotNum int `json:"robotnum"` // 机器人数量上限,0关闭机器人
|
||
RobotEvaluation int `json:"bot_rate"` // 概率型机器人权重
|
||
RobotAplomb int `json:"bot_steady"` // 稳健型机器人权重
|
||
RobotRadical int `json:"bot_radical"` // 激进型机器人权重
|
||
RobotNormal int `json:"bot_normal"` // 普通型机器人权重
|
||
RobotRotten int `json:"bot_low"` // 摆烂型机器人权重
|
||
|
||
RobotMinScore int64 `json:"bot_min_score"` // 机器人积分下限
|
||
RobotMaxScore int64 `json:"bot_max_score"` // 机器人积分上限
|
||
}
|
||
|
||
var ClubRobotConfigs = map[int64]*ClubRobotConfig{}
|
||
|
||
func (c *ClubRobotConfig) RobotTempers() (rt map[RobotTemper]int, sumWeight int) {
|
||
rt = map[RobotTemper]int{}
|
||
rt[RteEvaluation] = c.RobotEvaluation
|
||
rt[RteAplomb] = c.RobotAplomb
|
||
rt[RteRadical] = c.RobotRadical
|
||
rt[RteNormal] = c.RobotNormal
|
||
rt[RteRotten] = c.RobotRotten
|
||
sumWeight = c.RobotEvaluation + c.RobotAplomb + c.RobotRadical + c.RobotNormal + c.RobotRotten
|
||
return
|
||
}
|
||
|
||
func FindClubRobotConfig(blind int64, playType int) *ClubRobotConfig {
|
||
for _, conf := range ClubRobotConfigs {
|
||
if int64(conf.RoomBlind) == blind && conf.RoomPlayType == playType {
|
||
return conf
|
||
}
|
||
}
|
||
return &ClubRobotConfig{}
|
||
}
|