You are viewing a single comment's thread. Return to all comments →
You don't even need the boolean. In your uphill block, before you increment level, just check if your level is -1. If it is, increment valleys.
Since he always starts and ends at sea level, he will never go from -1 to 0 unless he is leaving a valley.
Seems like cookies are disabled on this browser, please enable them to open this website
Counting Valleys
You are viewing a single comment's thread. Return to all comments →
You don't even need the boolean. In your uphill block, before you increment level, just check if your level is -1. If it is, increment valleys.
Since he always starts and ends at sea level, he will never go from -1 to 0 unless he is leaving a valley.