Post
Topic
Board Gambling discussion
Re: Seuntjie' Dice bot programmers mode discussion.
by
seuntjie
on 17/09/2020, 09:34:09 UTC
but how can i make bot stop after it had currentstreak = -10
or 10 losses and it has to win back to original balance then stop?
Saw your other post on the other bot thread...
how do we stop bot if it struck a losing streak of 10, ie, currentstreak = -10 and we need to stop it only when it wins [more losing steps may follow after hitting -10] above the original balance when it was positive?

my sample didn't work:
if currentstreak <= -10 and win then
stop()
alarm()
print("stopping after bad streak")
end

You will never have currentstreak < 0 and win == true at the same time... as soon as a win is recorded, if currentstreak was < 0, then currentstreak is set to 1... likewise, currentstreak will never be > 0 and win == false, because as soon as a loss is recorded, if currentstreak was > 0, then currentstreak is set to -1.

You will need to create your own "flag" variable... set that to true when currentstreak >= -10... then when you get a "win", check the flag and stop as required.

Something like this:
Code:
...
badstreak = false
...
function dobet()
...
  if win then
    if badstreak then
      stop()
      alarm()
      print("stopping after bad streak")
    end
    badstreak = false
    ...
  end
  ...
  if currentstreak <= -10 then
    badstreak = true
  end if
end

Another way you can do this (that is a bit simpler imo) is to manually tack your previous streak, for example:


Code:
...
previousstreak= 0
...
function dobet()
...
  if win then
    if previousstreak <= -10  then
      stop()
      alarm()
      print("stopping after bad streak")
    end    
    ...
  end
  ...
  previousstreak=currentstreak --make sure this is always at the end of dobet
end