Box the compass: Difference between revisions
Content added Content deleted
Langurmonkey (talk | contribs) |
Langurmonkey (talk | contribs) |
||
Line 3,773: | Line 3,773: | ||
=={{header|langur}}== |
=={{header|langur}}== |
||
{{trans|D}} |
{{trans|D}} |
||
<syntaxhighlight lang="langur">val |
<syntaxhighlight lang="langur">val box = ["North", "North by east", "North-northeast", "Northeast by north", |
||
"Northeast", "Northeast by east", "East-northeast", "East by north", |
"Northeast", "Northeast by east", "East-northeast", "East by north", |
||
"East", "East by south", "East-southeast", "Southeast by east", |
"East", "East by south", "East-southeast", "Southeast by east", |
||
Line 3,782: | Line 3,782: | ||
"Northwest", "Northwest by north", "North-northwest", "North by west"] |
"Northwest", "Northwest by north", "North-northwest", "North by west"] |
||
val |
val angles = [ |
||
0.0, 16.87, 16.88, 33.75, 50.62, 50.63, 67.5, 84.37, 84.38, |
0.0, 16.87, 16.88, 33.75, 50.62, 50.63, 67.5, 84.37, 84.38, |
||
101.25, 118.12, 118.13, 135.0, 151.87, 151.88, 168.75, 185.62, |
101.25, 118.12, 118.13, 135.0, 151.87, 151.88, 168.75, 185.62, |
||
Line 3,791: | Line 3,791: | ||
writeln "----- ------- -------------" |
writeln "----- ------- -------------" |
||
for |
for phi in angles { |
||
val |
val i = trunc(phi * 32 / 360 + 0.5) rem 32 + 1 |
||
writeln "{{ |
writeln "{{i:5}} {{phi:r2:6}} {{box[i]}}" |
||
} |
|||
</syntaxhighlight> |
|||
{{out}} |
{{out}} |