-3 loops per iteration by only incrementing loop count when math is actually being handled
This commit is contained in:
parent
6bf671f82d
commit
4a5e33c9a0
|
@ -98,11 +98,10 @@ export const mathSolver = (conf: MathConf[], wrapDetails = false): SolvedStep =>
|
||||||
loggingEnabled && log(LT.LOG, `Evaluating roll ${JSON.stringify(conf)} | Evaluating ${JSON.stringify(curOps)}`);
|
loggingEnabled && log(LT.LOG, `Evaluating roll ${JSON.stringify(conf)} | Evaluating ${JSON.stringify(curOps)}`);
|
||||||
// Iterate thru all operators/operands in the conf
|
// Iterate thru all operators/operands in the conf
|
||||||
for (let i = 0; i < conf.length; i++) {
|
for (let i = 0; i < conf.length; i++) {
|
||||||
loopCountCheck('mathSolver.ts - evaluating roll');
|
|
||||||
|
|
||||||
loggingEnabled && log(LT.LOG, `Evaluating roll ${JSON.stringify(conf)} | Evaluating ${JSON.stringify(curOps)} | Checking ${JSON.stringify(conf[i])}`);
|
loggingEnabled && log(LT.LOG, `Evaluating roll ${JSON.stringify(conf)} | Evaluating ${JSON.stringify(curOps)} | Checking ${JSON.stringify(conf[i])}`);
|
||||||
// Check if the current index is in the active tier of operators
|
// Check if the current index is in the active tier of operators
|
||||||
if (curOps.includes(conf[i].toString())) {
|
if (curOps.includes(conf[i].toString())) {
|
||||||
|
loopCountCheck('mathSolver.ts - evaluating roll');
|
||||||
// Grab the operands from before and after the operator
|
// Grab the operands from before and after the operator
|
||||||
const operand1 = conf[i - 1];
|
const operand1 = conf[i - 1];
|
||||||
const operand2 = conf[i + 1];
|
const operand2 = conf[i + 1];
|
||||||
|
|
Loading…
Reference in New Issue