sisyphus: modify min/max times a little more

This commit is contained in:
Chris Sexton 2017-11-06 14:40:43 -05:00
parent df956513c2
commit 7e1c4e1106
2 changed files with 6 additions and 2 deletions

View File

@ -105,7 +105,9 @@ type Config struct {
} }
Sisyphus struct { Sisyphus struct {
MinDecrement int MinDecrement int
MaxDecrement int
MinPush int MinPush int
MaxPush int
} }
} }

View File

@ -60,7 +60,8 @@ func (g *game) scheduleDecrement() {
g.timers[0].Stop() g.timers[0].Stop()
} }
minDec := g.bot.Config().Sisyphus.MinDecrement minDec := g.bot.Config().Sisyphus.MinDecrement
g.nextDec = time.Now().Add(time.Duration((60 + rand.Intn(60*minDec))) * time.Minute) maxDec := g.bot.Config().Sisyphus.MinDecrement
g.nextDec = time.Now().Add(time.Duration((minDec + rand.Intn(maxDec))) * time.Minute)
go func() { go func() {
t := time.NewTimer(g.nextDec.Sub(time.Now())) t := time.NewTimer(g.nextDec.Sub(time.Now()))
g.timers[0] = t g.timers[0] = t
@ -76,7 +77,8 @@ func (g *game) schedulePush() {
g.timers[1].Stop() g.timers[1].Stop()
} }
minPush := g.bot.Config().Sisyphus.MinPush minPush := g.bot.Config().Sisyphus.MinPush
g.nextPush = time.Now().Add(time.Duration(rand.Intn(60)+minPush) * time.Minute) maxPush := g.bot.Config().Sisyphus.MaxPush
g.nextPush = time.Now().Add(time.Duration(rand.Intn(maxPush)+minPush) * time.Minute)
go func() { go func() {
t := time.NewTimer(g.nextPush.Sub(time.Now())) t := time.NewTimer(g.nextPush.Sub(time.Now()))
g.timers[1] = t g.timers[1] = t