tidy stockIndex incrementing

This commit is contained in:
Adam Piontek 2022-09-07 09:49:52 -04:00
parent d98778d86d
commit 031635d6d7

View file

@ -126,8 +126,7 @@ function solve(pyramidArray, stockArray, stockIndex = 0, moveArray = []) {
let cardA = new Card(pyramidArray[freeCardsIndices[i]]); let cardA = new Card(pyramidArray[freeCardsIndices[i]]);
if (!cardA.isSequential(topStock)) continue; if (!cardA.isSequential(topStock)) continue;
let newStock = JSON.parse(JSON.stringify(stockArray)); let newStock = JSON.parse(JSON.stringify(stockArray));
newStock.splice(stockIndex + 1, 0, cardA.toString); newStock.splice(++stockIndex, 0, cardA.toString);
stockIndex++;
newMoveArray = JSON.parse(JSON.stringify(moveArray)); newMoveArray = JSON.parse(JSON.stringify(moveArray));
newMoveArray.push(MoveString.match(cardA.toString)); newMoveArray.push(MoveString.match(cardA.toString));