优化机器人日志

This commit is contained in:
zhl 2021-03-19 16:11:48 +08:00
parent 257053b667
commit 8446807d62
2 changed files with 8 additions and 7 deletions

View File

@ -200,7 +200,7 @@ export class Robot {
hasEatCard = true
}
}
log(`discard: ${ self.sessionId } ${ cardIds }`)
// log(`discard: ${ self.sessionId } ${ cardIds }`)
let repData: any = {
cards: cardIds
}

View File

@ -114,7 +114,7 @@ function parseCheat(this: any, cardArr: Card[], rate: number, eatCard?: Card) {
let minCount = eatCard ? new GameEnv().otherEatCount : new GameEnv().selfEatCount
if (cardArr.length >= minCount && rate > 0) {
let random = getRandom(0, 100)
robotLog(`check cheat ^_^ random: ${random}, rate: ${rate}`)
robotLog(`[discard] check cheat ^_^ random: ${random}, rate: ${rate}`)
if (random <= rate) {
let max = Math.min(minCount+2, cardArr.length + 1)
let randomCount = getRandom(minCount, max)
@ -180,6 +180,7 @@ function parseCheat(this: any, cardArr: Card[], rate: number, eatCard?: Card) {
}
}
const oneCardArr: Card[] = cardArr.randomGet(1)
robotLog(`[discard] no cheat: ${oneCardArr[0].number}`)
return {cards: oneCardArr }
}
@ -241,21 +242,21 @@ let assistantUtil = {
eatSecs,
normalSecs
} = this.checkDiscard({cardArr, eatCard})
robotLog(`discard check result: selfEat: ${selfEat}, otherEat: ${otherEat}`)
robotLog(`[discard] check: ${cardArr.map(o=>o.number)} selfEat: ${selfEat}, otherEat: ${otherEat}`)
let results: Card[] = []
let random = getRandom(0, 100)
if (otherEat && random <= noEatRate) {
robotLog(`cat eat, but random(${random}) less then cfg(${noEatRate})`)
robotLog(`[discard] cat eat, but random(${random}) <= cfg(${noEatRate})`)
} else if (otherEat && random > noEatRate) {
results = eatPairs.length > 0? eatPairs : eatSecs
robotLog(`eat card random(${random}) cfg(${noEatRate}) ${results.map(o=>o.number)}`)
robotLog(`[discard] eat card random(${random}) > cfg(${noEatRate}) ${results.map(o=>o.number)}`)
}
random = getRandom(0, 100)
if (selfEat && results.length == 0 && random <= noTripleRate) {
robotLog(`can hu, but random(${random}) less then cfg(${noTripleRate})`)
robotLog(`[discard] can hu, but random(${random}) <= cfg(${noTripleRate})`)
} if (selfEat && results.length == 0 && random > noTripleRate) {
results = normalPairs.length > 0 ? normalPairs : normalSecs
robotLog(`hu card random(${random}) cfg(${noTripleRate}) ${results.map(o=>o.number)}`)
robotLog(`[discard] hu card random(${random}) > cfg(${noTripleRate}) ${results.map(o=>o.number)}`)
}
if (results.length == 0) {
results = cardArr.randomGet(1)