Morton Goldberg wrote:

/ ...

>        case
>        when @heading >= 360.0
>           @heading -= 360.0 while @heading >= 360.0

@heading %= 360

>        when @heading < 0.0
>           @heading += 360.0 while @heading < 0.0

@heading %= 360 # same solution

In fact, now that I think about it, the entire block:

   case
   when @heading >= 360.0
     @heading -= 360.0 while @heading >= 360.0
   when @heading < 0.0
     @heading += 360.0 while @heading < 0.0
   end

can be replaced with:

@heading %= 360

For a net improvement in execution speed and readability.

I hope this doesn't come off as golfing, apparently a popular pastime here.

-- 
Paul Lutus
http://www.arachnoid.com