Grid Path Combinations
The Scenario:
Imagine you are controlling a robot navigating a city grid starting at Point A(0,0). Your mission is to reach the target at Point B. But there is a catch! You have limited battery, so you must take the shortest path possible.
and Segment
tools for you.
- Then you should only move Right (R)or Up (U) .
- You are only allowed to walk in grey lines. You cannot move diagonally!
- Therefore, in this model, you are strictly limited to Right and Up moves only.
- Use the Sliders
to set the distance of the target (How many steps Right & Up). - Click "Generate another path!" button
to see how the computer creates a random route using only your allowed steps.
and Segment
tools for you.
- Try to draw a some of the shortest paths from A to B(3,4)
- Check: For every path, you used exactly 3 Right and 4 Up steps, right? (You have to, otherwise you won't reach B!)
Part 2: Unlocking the Formula
Look at the generated paths again.
Even though every path looks different on the map, they all share a secret:
- To reach a target at Right = r and Up = u, you strictly need r Right moves and u Up moves.
- Total Steps (t) = r + u
- Every path is just a scrambled "word" made of these letters.
- Example for (3,4):
RRRUUUU,URURURU,UUUURRR...
- Example for (3,4):
- Selecting 3 spots for Right is exactly the same as leaving 4 spots for Up.
- Mathematically, choosing r items is the same as choosing the remaining (n-r) items.
- Remember the property:=