Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outline of pizza cube maximizer #2149

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

Ignose
Copy link
Contributor

@Ignose Ignose commented Oct 4, 2024

No description provided.

Comment on lines +175 to +177
(toSlot(item) === $slot`familiar`
? mallPrice($item`box of Familiar Jacks`)
: 0) +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't get multiple jacks from having multiple familiar items unfortunately

(acc, it) => acc + calculateItemValue(it, effect),
0,
);
const cost = pizzaItems.reduce((acc, it) => acc + mallPrice(it), 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const cost = pizzaItems.reduce((acc, it) => acc + mallPrice(it), 0);
const cost = sum(pizzaItems, mallPrice);

Comment on lines +206 to +209
const benefit = pizzaItems.reduce(
(acc, it) => acc + calculateItemValue(it, effect),
0,
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const benefit = pizzaItems.reduce(
(acc, it) => acc + calculateItemValue(it, effect),
0,
);
const benefit = sum(pizzaItems, (it) => calculateItemValue(it, effect));

value: calculateItemValue(item, effect),
}));

return maxBy(itemsWithValues, (entry) => entry.value).item;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return maxBy(itemsWithValues, (entry) => entry.value).item;
return maxBy(itemsWithValues, "value").item;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also fwiw if you aren't using the values outside of the maxby it makes more sense to not do the map at all and to instead just ```typescript
return maxBy(items, (it) => calculateItemValue(it, effect));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants