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

Use static lookup table for solution #12

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

alexis-matuk
Copy link

@alexis-matuk alexis-matuk commented Jun 20, 2024

Changed the calculation logic to instead use a static solutions matrix as proposed in this issue #9. The current implementation has a static matrix which contains every possible in-game scenario for the encounter, and anything that's not in that matrix will display an error telling the user to check their inputs.

Solution matrix was generated by https://github.com/alexis-matuk/verity-solver if you want to check the logic. Every final solution is checked against the expected results given the inside callouts, so there can't be solutions that produce a wrong result in the final solution matrix.

getSolution: function(){
if(this.insideGuardianLeft && this.insideGuardianMiddle && this.insideGuardianRight && this.outsideGuardianLeft && this.outsideGuardianMiddle && this.outsideGuardianRight){
var scenario = this.insideGuardianLeft + this.insideGuardianMiddle + this.insideGuardianRight + this.outsideGuardianLeft + this.outsideGuardianMiddle + this.outsideGuardianRight;
if (!this.solutionsMatrix.hasOwnProperty(scenario)){
Copy link
Contributor

Choose a reason for hiding this comment

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

free thought: from a solution point of view, many of the solutions here are kinda redundant - as one example, TriangleSquareCirclePrismPrismSphere is the same as SquareTriangleCirclePrismPrismSphere. if you key the solutions as insideL + outsideL + insideM + outsideM + insideR + outsideR you could cut down the number of solutions to look at by sorting left/mid/right before concatenating each aisle and looking up. then you'd need to remap the solution to the correct real lanes. as an example, the earlier (S+TC, T+TC, C+SS) example would be looked up as (C+SS, S+TC, T+TC), then once you have the solution remapping that to the real S/T/C calls to fix up left/middle/right. that would drop the number of states down to 21!

it's also somewhat more complicated, so i totally understand if this just sounds unhinged. what's here seems totally reasonable :)

@iximeow
Copy link
Contributor

iximeow commented Jun 21, 2024

siiiick. i didn't have it in me to figure out an exhaustive solver, nice that it's relatively tiny! i haven't really looked through the solutions nor the solver itself but a few i spot checked seem pretty reasonable. doubly nice that you can point out more obviously incorrect calls 🙏

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