# Seuntjies DiceBot

## DiceBot => Programmer Mode => Topic started by: parakazani on August 13, 2019, 10:03:25 pm

Title: sum 10 roll
Post by: parakazani on August 13, 2019, 10:03:25 pm
Hi, I want to write a code
I want to say (sum of last 10 roll )= X
how can I write it?
in every roll this X value will chance
Title: Re: sum 10 roll
Post by: BlueSuede on August 13, 2019, 11:24:27 pm
Do you want the sum of the last 10 rolls to be the next bet amount? The payout amount?
Title: Re: sum 10 roll
Post by: parakazani on August 13, 2019, 11:56:14 pm
actualyy, I want to sum last 10  99/Roll value(A)   and  sum last 30   99/Roll  Value(B)
while  A<B  I want to make bet amount 0.0001   else 0.0000001
Title: Re: sum 10 roll
Post by: BlueSuede on August 14, 2019, 12:12:37 am
actualyy, I want to sum last 10  99/Roll value(A)   and  sum last 30   99/Roll  Value(B)
while  A<B  I want to make bet amount 0.0001   else 0.0000001

I'm not sure I'm understanding clearly. Lets say the last 10 rolls are 14.72, 13.18, 18.05, 61.47, 8.04, 72.03, 98.04, 77.88, 43.59, 13.91. You want to add all these up, which comes out to 420.91. From here you want 99/420.91, which comes out to 0.235204675583854. This number gets added to variable A.

Then the same thing is done for B, but with the sum of the last 30 rolls.

Title: Re: sum 10 roll
Post by: parakazani on August 14, 2019, 12:56:11 am
14.72, 13.18, 18.05, 61.47, 8.04, 72.03, 98.04, 77.88, 43.59, 13.91.   these are rolls,   99/14,72 + 99/13,18  + ..... +99/13,91    I'll calculate its average I mean Im  gonna divide it 10 and lets say A to this avg
Then the same thing is done for B, but with the sum of the last 30 rolls.  Im gonna divide It 30 and I ll find the average again. Lets say B to this avg.

then I want to do tihs;

if B>A
betamount 0.001
else
betamount 0.0000001

PLEASE REMOVE THİS VARIFICATION , It asks 0-0  I say 0 but it says no,  it asks 100-550 , answer is -450 but it says no, It makes me crazy.
Title: Re: sum 10 roll
Post by: BlueSuede on August 14, 2019, 12:20:27 pm
Code: [Select]
`myBasebet = 0.0000001nextbet = myBasebetchance    = 50.00bethigh   = truebetA = 0.0000001   -- Bet this amount if B < AbetB = 0.001    -- Bet this amount if B > AdebugInfo = truemaxProfit = 0.01  -- stop script after profit goal reachedtarget = balance+maxProfitresetseed()  -- Reset seed at start of scriptresetstats() -- Reset stats at start of script-- Average VariablesarrayA = {}  -- Array to store last 10 rollsarrayA_sum = 0arrayA_avg = 0arrayA_maxSize = 10arrayB = {}  -- Array to store last 30 rollsarrayB_sum = 0arrayB_avg = 0arrayB_maxSize = 30function dobet() table.insert(arrayA, lastBet.Roll) if(table.getn(arrayA) > arrayA_maxSize) then table.remove(arrayA, 1) end arrayA_sum = 0 for k, v in ipairs(arrayA) do arrayA_sum += v end arrayA_avg = arrayA_sum / table.getn(arrayA) table.insert(arrayB, lastBet.Roll) if(table.getn(arrayB) > arrayB_maxSize) then table.remove(arrayB, 1) end arrayB_sum = 0 for k, v in ipairs(arrayB) do arrayB_sum += v end arrayB_avg = arrayB_sum / table.getn(arrayB) if(arrayB_avg > arrayA_avg) then nextbet = betB else nextbet = betA end if(debugInfo) then print("=====Debug: Additional Info=====") print("arrayA: " .. table.concat(arrayA,", ")) print("arrayA Size: " .. table.getn(arrayA)) print("arrayA Sum: " .. arrayA_sum) print("arrayA Avg: " .. arrayA_avg) print("================================") print("arrayB: " .. table.concat(arrayB,", ")) print("arrayB Size: " .. table.getn(arrayB)) print("arrayB Sum: " .. arrayB_sum) print("arrayB Avg: " .. arrayB_avg) end end`
I believe this is what you're looking for. If you need any adjustments, please let me know.
Title: Re: sum 10 roll
Post by: parakazani on August 14, 2019, 10:28:40 pm
you r great! thank u so much, I can change some values , no problem:)