Jump to content

Box the compass: Difference between revisions

Add Factor
(→‎{{header|Julia}}: Updated for Julia 1.2)
(Add Factor)
Line 1,835:
32 North by west 354.37°
1 North 354.38°</pre>
 
=={{header|Factor}}==
<lang Factor>USING: formatting kernel math sequences ;
 
CONSTANT: box
{
"North" "North by east" "North-northeast"
"Northeast by north" "Northeast" "Northeast by east"
"East-northeast" "East by north" "East" "East by south"
"East-southeast" "Southeast by east" "Southeast"
"Southeast by south" "South-southeast" "South by east"
"South" "South by west" "South-southwest"
"Southwest by south" "Southwest" "Southwest by west"
"West-southwest" "West by south" "West" "West by north"
"West-northwest" "Northwest by west" "Northwest"
"Northwest by north" "North-northwest" "North by west"
}
 
{
0 16.87 16.88 33.75 50.62 50.63 67.5 84.37 84.38 101.25
118.12 118.13 135 151.87 151.88 168.75 185.62 185.63 202.5
219.37 219.38 236.25 253.12 253.13 270 286.87 286.88 303.75
320.62 320.63 337.5 354.37 354.38
}
 
[
dup 32 * 360 /f 0.5 + >integer 32 mod [ 1 + ] [ box nth ] bi
"%6.2f° %2d %s\n" printf
] each</lang>
{{out}}
<pre>
0.00° 1 North
16.87° 2 North by east
16.88° 3 North-northeast
33.75° 4 Northeast by north
50.62° 5 Northeast
50.63° 6 Northeast by east
67.50° 7 East-northeast
84.37° 8 East by north
84.38° 9 East
101.25° 10 East by south
118.12° 11 East-southeast
118.13° 12 Southeast by east
135.00° 13 Southeast
151.87° 14 Southeast by south
151.88° 15 South-southeast
168.75° 16 South by east
185.62° 17 South
185.63° 18 South by west
202.50° 19 South-southwest
219.37° 20 Southwest by south
219.38° 21 Southwest
236.25° 22 Southwest by west
253.12° 23 West-southwest
253.13° 24 West by south
270.00° 25 West
286.87° 26 West by north
286.88° 27 West-northwest
303.75° 28 Northwest by west
320.62° 29 Northwest
320.63° 30 Northwest by north
337.50° 31 North-northwest
354.37° 32 North by west
354.38° 1 North
</pre>
 
=={{header|Fortran}}==
1,808

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.