Repeated Math operation (#584)

Co-authored-by: Oleksii Trekhleb <trehleb@gmail.com>
This commit is contained in:
vladimirschneider
2020-12-10 23:50:47 +07:00
committed by GitHub
parent bbe0462b1c
commit 498ab10b1b

View File

@ -25,7 +25,7 @@ export default function bfRainTerraces(terraces) {
if (terraceBoundaryLevel > terraces[terraceIndex]) { if (terraceBoundaryLevel > terraces[terraceIndex]) {
// Terrace will be able to store the water if the lowest of two left and right highest // Terrace will be able to store the water if the lowest of two left and right highest
// terraces are still higher than the current one. // terraces are still higher than the current one.
waterAmount += Math.min(leftHighestLevel, rightHighestLevel) - terraces[terraceIndex]; waterAmount += terraceBoundaryLevel - terraces[terraceIndex];
} }
} }