Guest User

Untitled

a guest
Aug 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. const baseBet = 100 // how many satoshis to bet initially
  2. const target = 2.00 // target multiplier
  3. const betMultiplier = 2 // what to multiply the bet size by when we lose a wager
  4. let continuousRecovery = true //if true then numberOfRecoveryTries isn't applied
  5. const numberOfRecoveryTries = 10
  6. const resetSeedEveryXgames = 10
  7.  
  8. //---------------------------------------------------------------
  9. let resetCounter = 0
  10. let lossCount = 0
  11. this.log(`Starting martingale with a base bet of ${baseBet} satoshis.`)
  12.  
  13. while (true) {
  14. resetCounter++
  15. if (resetCounter > resetSeedEveryXgames) {
  16. setNewSeed()
  17. resetCounter = 0
  18. }
  19. // make the bet and wait for the result
  20. const { multiplier } = await this.bet(betSize(lossCount), target)
  21.  
  22. if (multiplier < target) { // loss
  23. lossCount++
  24. if (!continuousRecovery && lossCount >= numberOfRecoveryTries) {
  25. lossCount = 0
  26. this.log(`Tried too hard to recovery but failed. Resetting bet now.`)
  27. }else{
  28. this.log(`Lost bet. Multiplying bet size by ${betMultiplier} for new bet size of ${betSize(lossCount)} satoshis.`)
  29. }
  30. } else { // win
  31. lossCount = 0
  32. this.log(`Won bet. Setting bet size to ${baseBet} satoshis.`)
  33. }
  34. }
  35.  
  36. function betSize(lossCount) {
  37. const bet = baseBet * Math.pow(betMultiplier, lossCount)
  38. return Math.round(bet / 100) * 100
  39. }
  40.  
  41. function setNewSeed() {
  42. const { server_seed_hash } = await this.newSeedPair()
  43. await this.log("The new server seed has the hash: ", server_seed_hash)
  44.  
  45. // set the client seed
  46. const clientSeed = randomSeed()
  47. await this.setClientSeed(clientSeed)
  48. await this.log("The client seed was set to: ", clientSeed)
  49. }
  50.  
  51. function randomSeed() {
  52. const words = ['Alpha ','Bra3qtwvo ','Charlie ','Delta ','Echo ',
  53. 'Foxtrot ','Go3tewlf ','Hotel ','Indda ','Juliet ',
  54. 'Kiqagalo ','L24rqwima ','Mirhe ','November ','Oscar ',
  55. 'Papayww ','Quebec ','Romeo ','Sierra ','Tango ',
  56. 'Uniform ','Victor ','Whiskey ','X-ray ','pooper ','Zulu ']
  57.  
  58. return words[Math.floor(words.length * Math.random())] + words[Math.floor(words.length * Math.random())] + words[Math.floor(words.length * Math.random())]
  59. }
Add Comment
Please, Sign In to add comment