xplodwild / realmdefensecheat

Cheating Tool for Babeltime's Realm Defense game
MIT License
16 stars 7 forks source link

fix sign flip on s = -1 #2

Closed IcanMorris closed 5 years ago

IcanMorris commented 5 years ago

Negative O-values flip the result:

7 is the desired encoded value, the random O-value part is 10, s resolved negative

s = -1 o = 10 * -1 v = -10 + 7 => -3

(-3 - (-10)) -1 ( 7 ) -1 => -7

The desired value also needs to be multiplied by s:

s = -1 o = 10 -1 v = -10 + (7 -1) => -17

(-17- (-10)) -1 ( -7 ) -1 => 7

xplodwild commented 5 years ago

NIce catch, I had noticed something was going wrong but didn't have time to check the maths. I should've done unit tests there too :) Thanks