Question Authors' Forum

Python Turtle Drawing

 
Picture of Patrick Wang
Python Turtle Drawing
by Patrick Wang - Friday, 21 April 2017, 12:32 AM
 

Hi,

Is there any way to test turtle drawing question in python? For example, the question may ask students to draw a triangle with three vertices at (0,0), (50, 50), (60,60), so that the position of the triangle is fixed.

Any template that we can use?

Thanks.

Picture of Richard Lobb
Re: Python Turtle Drawing
by Richard Lobb - Wednesday, 26 April 2017, 7:26 AM
 

Hi Patrick

Good question - I've wondered about this, too. But from the silence it looks like no one has a solution for you.

It would be easy enough to build a mock turtle (echoes of Alice In Wonderland!) in the template to record what turtle commands the student code issued. But validating those against a reference solution is difficult, at least in the general case.

Your triangle example, with integer coordinates, is relatively straightforward but even that has complications. The three lines could be drawn in any order and drawn in any direction. They could be drawn as individual lines with integer coordinates using turtle.goto() or using floating point distances with turtle.forward(). Or a filled polygon could be drawn with those three vertices - would that be accepted? Furthermore, it can be difficult to issue helpful error messages to the student when answers are deemed wrong: it's very frustrating for a student simply to be told their answer is wrong without a clear reason. Did they get marked wrong because they used 1.414 instead of math.sqrt(2) or did they draw a mirror image of the required answer or ... ?

If you make any progress on this, please tell us about it here :)

Richard

Picture of Patrick Wang
Re: Python Turtle Drawing
by Patrick Wang - Friday, 28 April 2017, 1:45 PM
 

Hi Richard,

Thanks for your insight. I agree with you that it is quite difficult. 

Let me try first. I will update you if I make any progress.


Patrick