Box the compass: Difference between revisions

imported>Regattaguru
(2 intermediate revisions by 2 users not shown)
Line 1,992:
=={{header|Delphi}}==
See [https://rosettacode.org/wiki/Box_the_compass#Pascal Pascal].
=={{header|EasyLang}}==
{{trans|Kotlin}}
<syntaxhighlight>
func$ expand cp$ .
for c$ in strchars cp$
if c$ = "N"
r$ &= "north"
elif c$ = "E"
r$ &= "east"
elif c$ = "S"
r$ &= "south"
elif c$ = "W"
r$ &= "west"
elif c$ = "b"
r$ &= "by"
else
r$ &= "-"
.
.
h$ = strchar (strcode substr r$ 1 1 - 32)
return h$ & substr r$ 2 999
.
proc main . .
cp$[] = [ "N" "NbE" "N-NE" "NEbN" "NE" "NEbE" "E-NE" "EbN" "E" "EbS" "E-SE" "SEbE" "SE" "SEbS" "S-SE" "SbE" "S" "SbW" "S-SW" "SWbS" "SW" "SWbW" "W-SW" "WbS" "W" "WbN" "W-NW" "NWbW" "NW" "NWbN" "N-NW" "NbW" ]
print "Index Degrees Compass point"
print "----- ------- -------------"
for i = 0 to 32
ind = (i + 1) mod1 32
heading = i * 11.25
if i mod 3 = 1
heading += 5.62
elif i mod 3 = 2
heading -= 5.62
.
print ind & "\t" & heading & "\t" & expand cp$[ind]
.
.
main
</syntaxhighlight>
 
=={{header|Elixir}}==
{{trans|Ruby}}
Line 2,055 ⟶ 2,095:
1 North 354.38
</pre>
 
=={{header|Euphoria}}==
<syntaxhighlight lang="euphoria">constant names = {"North","North by east","North-northeast","Northeast by north",
Line 3,732 ⟶ 3,773:
=={{header|langur}}==
{{trans|D}}
{{works with|langur|0.6.13}}
<syntaxhighlight lang="langur">val .box = ["North", "North by east", "North-northeast", "Northeast by north",
"Northeast", "Northeast by east", "East-northeast", "East by north",
Line 3,752 ⟶ 3,792:
 
for .phi in .angles {
val .i = truncatetrunc(.phi x* 32 / 360 + 0.5) rem 32 + 1
writeln $"\{.i:5;} \{.phi:r2:6;} \{.box[.i];}"
}</syntaxhighlight>
 
Line 3,793 ⟶ 3,833:
1 354.38 North
</pre>
 
=={{header|Lasso}}==
<syntaxhighlight lang="lasso">define pointsarray() => {
885

edits