Add basic laughing stock predictor - #874
Conversation
…to LaughingStock
Backs the mocked mafia RNG functions with kol-rng, which simulates the same PHP 5.3.10 Mersenne Twister that KoL uses, so the predictor can be exercised end to end. The expected drops were recorded against the fixedDropTurns implementation and do not match the triangular number version. The 1-in-50 drops past combat 56 are unchanged, but the deterministic drops are now keyed one combat earlier, and the first one lands on key 0 where the fight > charges filter in expectedDropsToday can never return it.
|
Correction on my last comment — I'd written that test with The substance is unchanged: the expected drops are the pre-triangular-n ones, and the deterministic half disagrees. |
spaghetti-squash
left a comment
There was a problem hiding this comment.
Is the pity count/threshold the only reason we have to compute all of the drops prior to the point your'e at?
|
|
||
| for (let i = 0; i < getDeterministicDrops(deterministicFights); i++) { | ||
| const fight = 1 + (i * (i + 1)) / 2; | ||
| const rng = phpSeed(getSeed(classId, pathId, daycount) + 381 * (fight - 1)); |
There was a problem hiding this comment.
Is creating a new php seed each instance actually Correct here? I thought php rngs persisted stateful information, based on my first reading of the code. Maybe I'm wrong! I do see that fight is included in the seed so I guess that's fine, actually.
There was a problem hiding this comment.
I have no idea; phpSeeds are alchemy to me.
Co-authored-by: neil <78829653+spaghetti-squash@users.noreply.github.com>
Co-authored-by: neil <78829653+spaghetti-squash@users.noreply.github.com>
Co-authored-by: neil <78829653+spaghetti-squash@users.noreply.github.com>
| class FruitTracker { | ||
| private pityCount = 0; | ||
| private pityThreshold = 10; | ||
|
|
||
| getFruit(rng: Rng): Item { | ||
| const threshold = this.pityCount < 3 ? this.pityThreshold : 3; | ||
| const isAdvanced = phpMtRand(rng, 1, 30) <= threshold; | ||
|
|
||
| if (isAdvanced) { | ||
| this.pityCount++; | ||
| this.pityThreshold = 10; | ||
| return ADVANCED_FRUIT[phpMtRand(rng, 0, 2)]; | ||
| } | ||
|
|
||
| this.pityThreshold += 10; | ||
| return BASIC_FRUIT[phpMtRand(rng, 0, 18)]; | ||
| } | ||
| } |
There was a problem hiding this comment.
I would probably put the rng into the constructor of this but otherwise cool and woke
There was a problem hiding this comment.
This might not actually work, given that we call it a lot with different rng seeds every time (as fight increments)? idk. Do what feels natural, I guess.
Co-authored-by: neil <78829653+spaghetti-squash@users.noreply.github.com>
No description provided.