|
#!/usr/bin/ruby
#
#
func point (index) {
var ix = (index % 32);
if (ix & 1) { "#{point((ix + 1) & 28)} by #{point(((2 - (ix & 2)) * 4) + ix & 24)}" }
elsif (ix & 2) { "#{point((ix + 2) & 24)}-#{point((ix | 4) & 28)}" }
elsif (ix & 4) { "#{point((ix + 8) & 16)}#{point((ix | 8) & 24)}" }
else { <north east south west>[ix / 8] }
}
func test_angle (ix) { ix * 11.25 + [0, 5.62, -5.62][ ix % 3 ] };
func angle_to_point(đ˝) { (đ˝ / 360 * 32) + 0.5 -> floor };
for ix in range(0, 32) {
var đ˝ = test_angle(ix);
printf(" %2d %6.2f° %s\n", ix % 32 + 1, đ˝, point(angle_to_point(đ˝)).tc);
}
|