javascript 1.3x比赛,失利1.1x 3轮和下注乘数5

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript 1.3x比赛,失利1.1x 3轮和下注乘数5相关的知识,希望对你有一定的参考价值。

const baseBet = 1                    
const baseTarget = 1.1               
const betMultiplier = 5                
const stopGameAfterLoss = 2             /* Trigger will lead to drop/stop script */
const dropInsteadOfStopScript = true    /* stop script or drop losses and continue play  */
const changeSeed = 3                    /* How much losses obtain, and then change seed to decrease chance of big streak, 0 to disable */
const lossTarget = 1.3
const lossRepeatTimes = 3

let lossCount = 0
let target = baseTarget
let bet = baseBet
let engine = this

while (true) {
    if (lossCount >= stopGameAfterLoss){
        if (dropInsteadOfStopScript == true){
            lossCount = 0
        } else {
            await this.stop()
        }
    }
    if (lossCount > changeSeed && changeSeed != 0) {
        await generateSeed()
    }
    for (let i = 0; i < lossRepeatTimes; i++){
        const { multiplier } = await this.bet(bet * 100, target)

        if (multiplier < target) { // loss    
            bet = bet * betMultiplier
            target = lossTarget
            lossCount++
        } else {
            lossCount = 0
            bet = baseBet
            target = baseTarget
            break;
        }
    }
}
  async function generateSeed(){
      const { server_seed_hash } = await engine.newSeedPair()
      engine.log(`Server seed: ${server_seed_hash}`)
      try {
          const clientSeed = randomSeed()
          await engine.setClientSeed(clientSeed)
          engine.log(`Your Seed was set to: ${clientSeed}`)
      }
      catch(e){
          engine.log(`Client seed already was reset and not used`)
      }
  }
  function randomSeed(){
      const words = ['Alegra ','Bravon ','Charlik ','Delago ','Zecho ','Forextromb ','Hotelka ','Gnomus ','Addicted ','Aurelia ','Zigalo ','Wiverma ',
      'Mariner ','Octoberfest ','Nascar ','Papaja ','Alberts ','Gomus ','Fierra ','GTO ','Unicorn ','Vicantus ','Siski ','Xavier ','Poiuplet ','Antutulika ']
  
      return words[Math.floor(words.length * Math.random())] + words[Math.floor(words.length * Math.random())] + words[Math.floor(words.length * Math.random())]
  }

以上是关于javascript 1.3x比赛,失利1.1x 3轮和下注乘数5的主要内容,如果未能解决你的问题,请参考以下文章

javascript获取窗口和div位置

BZOJ1449: [JSOI2009]球队收益

正则表达式介绍

《数值分析》-- 正交多项式

BZOJ1449/2895[JSOI2009]球队收益/球队预算 最小费用最大流

数学公式的显示