Skip to content

Tweaks: (enhancement) Add min module count setting to Case Generator #61

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Kodipher
Copy link

@Kodipher Kodipher commented May 8, 2025

With Reasonable Conclusion cases it is possible to disable smaller ones (e.g. 2x2 and 3x3) if the user prefers the vanilla bomb case or the Double Decker. This is not possible to do with the cases generated by Tweaks.

This PR adds a setting that discards cases under a user-defined threshold, allowing better case picker to choose non-generated cases for smaller bombs, if the user wants that.

Comment on lines +111 to +116
// Make sure a size is found even if the user threshold is enormous (above 2 * componentCount^2 - 1)
int caseSizeSearchLimit = System.Math.Max(componentCount, Tweaks.userSettings.CaseGeneratorMinModules + 1);

List<Vector2> caseSizes = new List<Vector2>();
for (int x = 1; x <= componentCount; x++)
for (int y = 1; y <= componentCount; y++)
for (int x = 1; x <= caseSizeSearchLimit; x++)
for (int y = 1; y <= caseSizeSearchLimit; y++)
Copy link
Owner

Choose a reason for hiding this comment

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

I don't understand why this change is needed. Why would we need to generate cases that are bigger than the maximum needed for the bomb?

Copy link
Author

@Kodipher Kodipher May 11, 2025

Choose a reason for hiding this comment

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

This particular change prevents a potential edge case issue... sort of:
There is a hidden assumption that the case generator always generates a valid case to be used, but if for whatever reason the user sets the minimum module threshold to be ridiculously and unpractically high (which.. why would they, but they might) then all potential cases sizes would be filtered out, breaking that assumption.

Concrete example: about 340 minimum with only 12 modules in a mission and no other modded cases installed will result in no valid cases, despite case generator being enabled.

But a lot of the time componentCount will be higher than the threshold anyway, so this does not impede performance, just handles the edge case.

Copy link
Author

Choose a reason for hiding this comment

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

So.. should this be marked resolved or.. should I revert this change?

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