text 一次玩3次并停止,手动+自动

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 一次玩3次并停止,手动+自动相关的知识,希望对你有一定的参考价值。

const baseBet = 200              
const target =15
const betMultiplier = 0.5        

const repeatBetTimes = 2
const increaseTargetEvery = 3
const TargetProfit = 5000   
const dontLoseThan = 0
let repeat = 3
const engine = this
let lossCount = 1
let _target = target
let incLose  = 0

while (true){
if (repeat <= 0){
await this.stop()}
repeat = repeat - 1
    checkConditions(this.balance)
    collectSound()
    //if (this.balance - betSize(lossCount) < dontLoseThan){}
   // if (betSize(lossCount) > 50 * 100){
    //    lossCount = 1
   // }
   // let lossRepeat = lossCount / repeatBetTimes +1
  //  if (lossRepeat <= 0){lossRepeat = 1}
        const {multiplier} = await this.bet(betSize(lossCount), _target)
    if (multiplier < _target) { // loss
        incLose++
        if (incLose >= increaseTargetEvery ){
            _target = _target + betMultiplier
            incLose =0
          //  if (_target >=15){
        //        _target = 1.5
           //    incLose = 0
       //     }
        }
        lossCount++
        this.log(`Lost bet. new bet size of ${betSize(lossCount)/100}.`)
    } else {   /*  [WINS]  */ 
        incLose = 0
        //lossCount = 1
lossCount++
        if (lossCount <= 1){
            lossCount = 1
        }
        gong()
        incLose = 0
        _target = target
        this.log(`Won bet. Setting bet size to ${baseBet/100}.`)
    }
}
function betSize(lossCount) {
      let bet = (baseBet) * lossCount
      return bet
  }

function gong() {
  const audio = new Audio("https://bustadice.com/5bb187b7ef764e76fb519939f77288c1.mp3")
  audio.play()
  return new Promise(resolve => audio.onended = resolve)
}
function collectSound(){
    const audio = new Audio ("http://kz-developer.ru/sounds/chipsHandle6.wav")
    audio.play()
    return new Promise(resolve => audio.onended = resolve)
}
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(`Seed was set to: ${clientSeed}`)
    }
    catch(e){
        engine.log(`Client seed already was reset and not used`)
    }
}
function randomSeed(){
    const words = ['Ze3foA1gAlpha ','Zefo3AG3B2r2a3qtwvo ','Zefo3AG313Charlie ','ZefoA22G3Delta ','Zef3o1GEcho ','ZefoA22G5oxtrot ','ZefoAG34G223tewlf ','Ze1o5A3GHotel ','ZefoA3dda ','Ze5f3Auliet ','ZefoAGK3agalo ','ZefoAG24rqwima ',
    'Zef5oAG2Mrhe ','ZefoAG52ovember ','Ze67foGOscar ','Zefo3A45apayww ','Zef44A2Quebec ','ZefoAG433omeo ','ZefoA4GSierra ','ZefoA41GTngo ','ZefoA445GUniorm ','Ze37oGVictor ','ZefoA33W4hiskey ','ZefA3G4oXay ','Zef4Gpooper ','ZefoA3GZulu ']

    return words[Math.floor(words.length * Math.random())] + words[Math.floor(words.length * Math.random())] + words[Math.floor(words.length * Math.random())]}

async function stopGame(){
  await engine.stop()
}
function checkConditions(balance){
    if(balance / 100 >= TargetProfit){
        engine.log(`You just did your profits, terminating script`)
        stopGame()
    }
    if(balance / 100 <= dontLoseThan){
        engine.log(`Stopper triggered script to terminate`)
        stopGame()
    }
}

以上是关于text 一次玩3次并停止,手动+自动的主要内容,如果未能解决你的问题,请参考以下文章

如果这是芳芳最后一次玩RAFT

表单自动仅提交一次并重新加载相同的页面

PHP 框架 |每 X 次刷新一次并翻阅页面数组

ionic 3 图像滑块在手动滑动后停止自动播放

Smarty - foreach 循环 10 次并停止

计时器每秒触发一次并更新 GUI(C# Windows 窗体)