Box the compass: Difference between revisions
Content added Content deleted
m (J: update explanation for updated code) |
(J: bugfix) |
||
Line 29:
points=:,2 ([;by;'-'tween;by~)&>/\ cardinal
indice=: 32 | 0.5 <.@+ %&11.25
fixup=: (rplc ''|.@;{.@;:@tolower)L:0
deg2pnt=: [:fixup points {~ indice</lang>
As for the required example, sometimes it's simpler to do just a small bit of "extra" work:
<lang j> ((1 ":@:+ ~."1@
1 North _5.62 0 5.62
2 North by
3 North-
4 Northeast by north 28.13 33.75 39.37
5 Northeast 39.38 45 50.62
6 Northeast by east 50.63 56.25 61.87
7 Northeast-east 61.88 67.5 73.12
8 East by
9 East 84.38 90 95.62
10 East by
11 East-
12 Southeast by east 118.13 123.75 129.37
13 Southeast 129.38 135 140.62
14 Southeast by south 140.63 146.25 151.87
15 Southeast-south 151.88 157.5 163.12
16 South by
17 South 174.38 180 185.62
18 South by
19 South-
20 Southwest by south 208.13 213.75 219.37
21 Southwest 219.38 225 230.62
22 Southwest by west 230.63 236.25 241.87
23 Southwest-west 241.88 247.5 253.12
24 West by
25 West 264.38 270 275.62
26 West by
27 West-
28 Northwest by west 298.13 303.75 309.37
29 Northwest 309.38 315 320.62
30 Northwest by north 320.63 326.25 331.87
31 Northwest-north 331.88 337.5 343.12
32 North by
1 North 354.38 360 365.62</lang>
|