At My Fingertips
Rapid Playground
Switzerland has an extensive hiking trail network with 65000 kilometers of signed hiking trails. There are three kinds of trails: hiking trails (marked in yellow), mountain hiking trails (marked in white-red-white), and alpine hiking trails (marked in white-blue-white).
The trails are signed with four kinds of signs, amongst them diamond-shaped hiking confirmations. These are used to confirm the trail: if you get off the trail, you will notice, because you won't encounter any confirmation signs anymore. They also are used to confirm the correctness of the direction of signposts: should a signpost get rotated and point in the wrong direction, hikers would notice because they wouldn't encounter any confirmation signs for a while.
Let's compose those confirmation signs with PyTamaro!
The hiking trail confirmation is a yellow diamond. The measurements are specified in the handbook of hiking trail signage published by Swiss Federal Office of Streets and the Swiss Hiking Trail Association. Here is the figure with the measaurements of a hiking trail confirmation:
The color is RAL 1007 "daffodil yellow", which in the RGB model consists of 232 red, 140 green, and 0 blue.
You probably saw two triangles. That's great!
The measurements of the triangle are given by its width and height. But the PyTamaro triangle function expects two sides and the enclosed angle.
You may want to decompose the diamond's triangle into two right triangles (top and bottom half). Those you can construct given the width and half the height.
You can use the right_triangle
function from your toolbox
(if you don't have that function in your toolbox yet, you may want to do the
Triangles activity).
Mountain hiking trails consist of three vertical bands in white-red-white. Here is the figure with the corresponding measaurements:
The two colors are:
The alpine hiking trail confirmation has the same structure as the mountain hiking trail confirmation. It simply uses different colors. Specifically, it uses blue instead of red for the middle band.
The two colors are:
You learned about one type of signage you encounter on the Swiss hiking trail network. This type of sign is very common. You should find one about every 10 minutes during your hike, and much more often in areas where the trail isn't clear.
You also (hopefully) practiced to structure your code so you can reuse functionality. The mountain and alpine confirmation signs are very similar. Did you manage to factor out the commonalities into separate functions?
This activity has been created by LuCE Research Lab and is licensed under CC BY-SA 4.0.
Swiss Hiking Confirmations
PyTamaro is a project created by the Lugano Computing Education Research Lab at the Software Institute of USI
Privacy Policy • Platform Version c08406b (Wed, 20 Nov 2024 12:30:00 GMT)