RosettaCodeData/Task/Box-the-compass/Picat/box-the-compass.picat
2023-07-01 13:44:08 -04:00

18 lines
873 B
Text

go =>
Names = ["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", "North"
],
foreach(I in 0..32)
J = I mod 32,
D = I * 11.25,
if I mod 3 == 1 then D := D + 5.62 end,
if I mod 3 == 2 then D := D - 5.62 end,
printf("%2d %-20s %6.2f\n", J+1, Names[J+1], D)
end,
nl.