Box the compass: Difference between revisions

Content added Content deleted
(→‎{{header|langur}}: modified output)
Line 3,218: Line 3,218:


=={{header|langur}}==
=={{header|langur}}==
{{works with|langur|0.6.8}}
{{works with|langur|0.6.13}}
<lang langur>val .box = ["North", "North by east", "North-northeast", "Northeast by north",
<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",
Line 3,233: Line 3,233:
185.63, 202.5, 219.37, 219.38, 236.25, 253.12, 253.13, 270.0,
185.63, 202.5, 219.37, 219.38, 236.25, 253.12, 253.13, 270.0,
286.87, 286.88, 303.75, 320.62, 320.63, 337.5, 354.37, 354.38]
286.87, 286.88, 303.75, 320.62, 320.63, 337.5, 354.37, 354.38]

writeln "index degrees compass point"
writeln "----- ------- -------------"


for .phi in .angles {
for .phi in .angles {
val .i = truncate(.phi x 32 / 360 + 0.5) rem 32 + 1
val .i = truncate(.phi x 32 / 360 + 0.5) rem 32 + 1
writeln $"\.i:2; \.box[.i]:18; \.phi;"
writeln $"\.i:5; \.phi:r2:6; \.box[.i];"
}</lang>
}</lang>


{{out}}
{{out}}
<pre> 1 North 0.0
<pre>index degrees compass point
----- ------- -------------
2 North by east 16.87
1 0.00 North
3 North-northeast 16.88
2 16.87 North by east
4 Northeast by north 33.75
5 Northeast 50.62
3 16.88 North-northeast
4 33.75 Northeast by north
6 Northeast by east 50.63
5 50.62 Northeast
7 East-northeast 67.5
8 East by north 84.37
6 50.63 Northeast by east
9 East 84.38
7 67.50 East-northeast
10 East by south 101.25
8 84.37 East by north
9 84.38 East
11 East-southeast 118.12
10 101.25 East by south
12 Southeast by east 118.13
13 Southeast 135.0
11 118.12 East-southeast
12 118.13 Southeast by east
14 Southeast by south 151.87
13 135.00 Southeast
15 South-southeast 151.88
14 151.87 Southeast by south
16 South by east 168.75
17 South 185.62
15 151.88 South-southeast
18 South by west 185.63
16 168.75 South by east
17 185.62 South
19 South-southwest 202.5
18 185.63 South by west
20 Southwest by south 219.37
21 Southwest 219.38
19 202.50 South-southwest
20 219.37 Southwest by south
22 Southwest by west 236.25
21 219.38 Southwest
23 West-southwest 253.12
22 236.25 Southwest by west
24 West by south 253.13
25 West 270.0
23 253.12 West-southwest
26 West by north 286.87
24 253.13 West by south
25 270.00 West
27 West-northwest 286.88
26 286.87 West by north
28 Northwest by west 303.75
29 Northwest 320.62
27 286.88 West-northwest
28 303.75 Northwest by west
30 Northwest by north 320.63
29 320.62 Northwest
31 North-northwest 337.5
30 320.63 Northwest by north
32 North by west 354.37
1 North 354.38</pre>
31 337.50 North-northwest
32 354.37 North by west
1 354.38 North
</pre>


=={{header|Liberty BASIC}}==
=={{header|Liberty BASIC}}==