Conversation
spaghetti-squash
left a comment
There was a problem hiding this comment.
Tentative approval. I'm concerned there may be other queue manipulators not being accounted for in your python script--it doesn't look like it checks for both the turtlesexy and the turtlesexless. But also I think we can just assume people have turtlesex; it's 300k and an autoperm, apparently
| export function barfEncounterRate(options: { | ||
| snapper?: boolean; | ||
| snapperPhylum?: Phylum; | ||
| olfact?: Monster; | ||
| longCon?: Monster; | ||
| motif?: Monster; | ||
| turtle?: Monster; | ||
| monkeyPoint?: Monster; | ||
| humanity?: boolean; | ||
| }): Map<Monster, number> { |
There was a problem hiding this comment.
just make this a Partial
| const copies = (target: Monster | null, n: number): Monster[] => | ||
| n === 0 ? [] : [...zoneMonsters.filter((m) => m === target), ...copies(target, n - 1)]; |
There was a problem hiding this comment.
I feel like a .fill solution will be more performant and legible than the recursive one
| const copies = (target: Monster | null, n: number): Monster[] => | ||
| n === 0 ? [] : [...zoneMonsters.filter((m) => m === target), ...copies(target, n - 1)]; | ||
|
|
||
| const monsterQueue = [ |
There was a problem hiding this comment.
call this the CSV, not the queue. Or call it some other thing. But don't call it the queue
| if (cachedValue) { | ||
| return cachedValue; | ||
| } |
There was a problem hiding this comment.
| if (cachedValue) { | |
| return cachedValue; | |
| } | |
| if (cachedValue) return cachedValue; |
| ...copies(monkeyPoint, 2), | ||
| ...zoneMonsters | ||
| .filter((m) => snapper && m.phylum === snapperPhylum) | ||
| .flatMap((m) => copies(m, 2)), |
There was a problem hiding this comment.
I have had trouble with polyfilling flatMap before; definitely make sure this works the way you want it to
| const encounters = monsterQueue.flatMap((m) => | ||
| monsterQueue.map((n) => | ||
| // olfaction, longcon, and motif caus that monster to ignore queue rejection | ||
| olfact === m || longCon === m || motif === m || !encounterQueue.includes(m) ? m : n, |
There was a problem hiding this comment.
| olfact === m || longCon === m || motif === m || !encounterQueue.includes(m) ? m : n, | |
| [olfact, longCon, motif].includes(m) && !encounterQueue.includes(m) ? m : n, |
|
|
||
| const zoneMonsters = $monsters`garbage tourist, angry tourist, horrible tourist family`; | ||
| const encounterQueue = zoneMonsters.filter((m) => | ||
| $location`Barf Mountain`.combatQueue.includes(`${m}`), |
There was a problem hiding this comment.
I think I prefer m.name here but I think using the template literal below makes sense so maybe being consistent within this area is better
| .flatMap((m) => copies(m, 2)), | ||
| ]; | ||
|
|
||
| const encounters = monsterQueue.flatMap((m) => |
There was a problem hiding this comment.
I don't understand what this variable is meant to represent
There was a problem hiding this comment.
update: I think I might understand it, but if I do then it's not quite right: we only reroll 75% of the time, but even a reroll can reroll.
This math is really hard to do--slaw wrote a big ol' thesis about it. I think we have to do it numerically instead of analytically.
|
I know that you're working on a whole new thing for this, but just as a reminder one decision we made in discord is that alongside this we should always print marginal familiar printouts in barf, not just when we pick marginal over it, and for snapper specifically we should add a |
| const dudeRate = [...encounterRate.entries()].reduce( | ||
| (acc: number, entry: [Monster, number]) => | ||
| entry[0].phylum === $phylum`dude` ? entry[1] + acc : acc, | ||
| 0, | ||
| ); |
There was a problem hiding this comment.
| const dudeRate = [...encounterRate.entries()].reduce( | |
| (acc: number, entry: [Monster, number]) => | |
| entry[0].phylum === $phylum`dude` ? entry[1] + acc : acc, | |
| 0, | |
| ); | |
| const dudeRate = sum([...encounterRate.entries()], ([monster, weight]) => monster.phylum === $phylum`dude` ? weight : 0); |
No description provided.