See the previous buggy behavior in this screenshot:
2 fixes:
Initialize highestPointColor to currentColor – This resolves the incorrect alternate route. Without this initialization, the previous code would never initialize highestPointColor if the current color already was the highest.
Fix off-by-one issue for minimum remaining turns to get the key – The rounding was not always correct. Replaced it with ceil so that any fractional turns remaining always result in 1 more being added.
Both of those fixes result in this behavior when in the same state as the original screenshot:
Edit: One critical change not reflected in the screenshots above – I added a period at the end of the remaining turns to match the rest of the tile 😛
See the previous buggy behavior in this screenshot:
2 fixes:
ceil
so that any fractional turns remaining always result in 1 more being added.Both of those fixes result in this behavior when in the same state as the original screenshot:
Edit: One critical change not reflected in the screenshots above – I added a period at the end of the remaining turns to match the rest of the tile 😛