1
1
mirror of https://github.com/Burn-E99/TheArtificer.git synced 2026-06-04 09:03:50 -04:00

V2.0.2 - Fix faulty array.splice in solver

This commit is contained in:
Ean Milligan (Bastion)
2022-07-09 02:23:42 -04:00
parent c4c7098479
commit f4b0e04cec
3 changed files with 6 additions and 4 deletions

View File

@@ -61,8 +61,10 @@ export const fullSolver = (conf: (string | number | SolvedStep)[], wrapDetails:
throw new Error('UnbalancedParens');
}
// Replace the itemes between openParen and closeParen (including the parens) with its solved equilvalent by calling the solver on the items between openParen and closeParen (excluding the parens)
conf.splice(openParen, closeParen + 1, fullSolver(conf.slice(openParen + 1, closeParen), true));
// Call the solver on the items between openParen and closeParen (excluding the parens)
const parenSolve = fullSolver(conf.slice(openParen + 1, closeParen), true);
// Replace the itemes between openParen and closeParen (including the parens) with its solved equilvalent
conf.splice(openParen, (closeParen - openParen + 1), parenSolve);
// Determing if we need to add in a multiplication sign to handle implicit multiplication (like "(4)2" = 8)
// insertedMult flags if there was a multiplication sign inserted before the parens