Pete Yandell wrote:
> On 04/12/2006, at 8:28 PM, Edwin Fine wrote:
> 
>> Here's my solution.
> 
> Ok, a couple of comments.
> 
> First, your home method doesn't raise the pen as it should.

You're right. That's what I get for working when too tired... :(.

> 
> Second, all that flipping between turtle space angles and normal
> angles is unnecessary. Just swap the x and y axes when doing the trig
> and you'll get the right result.

I did the x-y swapping in an earlier version of the program, but I feel 
the flipping is more intuitive for me. It also makes it easier for me to 
see how angles change between turtle space and conventional space.

> 
> Third, Ruby has an atan2 method that does most of what you do in your
> toward method.

You learn something new every day!

> Fourth, your normalize_degrees method is overkill. Try '-10 % 360' in
> irb.

Thanks for pointing that out. Language specifics are sometimes quite 
subtle. This is why it's good to post to RubyQuiz - I learn to do things 
in a better way. Thanks for your feedback.

-- 
Posted via http://www.ruby-forum.com/.