OpenTechSchool / python-beginners

Workshop material for "Introduction to Programming with Python"
http://opentechschool.github.io/python-beginners/
175 stars 253 forks source link

prison is confusing. #28

Open gnunicorn opened 11 years ago

gnunicorn commented 11 years ago

The prison exercise seems to be confusing in the way it is explained. Quoting one of our berlin participants:

... " the two turtle prison questions were a bit confusing since if the turtle only walks forward it doesn't make a difference whether the prison is circular or square (it would've been nicer if one could somehow see the difference). " ...

rschwarz commented 11 years ago

Today I was discussing this problem with a participant who wanted to do a recursive version, not using the while loop. It turned out to be really trick to determine, whether this call was going to leave the "prison area", and if so, to determine the point where the turtle hits the wall.

The proposed solution (going in steps of 1) will not be accurate when the distance is given as float, which was our assumption when reading it.

Ivoz commented 11 years ago

Welcome to the wonderful world of collision detection :)

rschwarz commented 11 years ago

Yes, you would have to solve a quadratic equation in any case, even with integer step lengths, since you can't assume that you are moving directly away from the origin.

At least, there should be a note, that it's OK to overstep the prison line a little bit, or to return a bit too early.

Ivoz commented 11 years ago

I might see if I can reword it then in combination with fixing up #41