RosettaCodeData/Task/Box-the-compass/Objeck/box-the-compass.objeck
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

34 lines
1.3 KiB
Text

class BoxCompass {
function : Main(args : String[]) ~ Nil {
points := [
"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 " ];
for(i := 0; i<= 32; i += 1;) {
heading := i * 11.25;
select(i % 3) {
label 1: {
heading += 5.62;
}
label 2: {
heading -= 5.62;
}
};
IO.Console->Print((i % 32) + 1)->Print('\t')->Print(points[GetPoint(heading)])
->Print('\t')->PrintLine(heading);
};
}
function : GetPoint(degrees : Float) ~ Int {
return (degrees / 11.25 + 0.5)->Floor()->As(Int) % 32;
}
}