Wednesday, February 20, 2008

one problem with scratch

In scratch I can't see any way to name your scripts. Unless I am missing something it can't be done.

This makes the classic, beautiful and elegant Barry Newell's turtle confusion puzzle sheet - my favourite introduction to turtle graphics - far more difficult to implement

I love Barry's puzzles because they start simple and scale to complex in the most deliciously, elegant fashion. He does this by using the earlier shapes as building blocks for the later shapes

For instance once you can draw a square with the cat starting and finishing in the middle (a centre-gon) then variations are possible by drawing smaller squares or rotating the cat before drawing same size squares


The scratch code shows how to draw one centred square.

In other versions of logo (microworlds, mswlogo) once you have the code for the centred square as a named procedure which can accept variable inputs then you can re-use the code elegantly to draw more complex shapes.

to twosquare
csquare 100
csquare 60
end

to rotatesquare
csquare 100
right 45
csquare 100
end

This elegance is not possible in scratch.

However, I did manage to complete one of Barry's more advanced shapes in scratch (number 38) which is a centred square rotated 9 times

using this scratch code:

So, the epistemological issue here is using names to blackbox code in order to write more elegant (clean) solutions to more complex problems.

Also there's no turtle in the default animal shapes. Outrageous :-) I miss that turtle. Mitch, can't you put it back in.

reference: Turtle confusion: Logo Puzzle and Riddles (1988) by Barry Newell

2 comments:

Wara said...

Do the 'broadcast' and 'when i receive' block help with this problem Bill?

Bill Kerr said...

hi wara,

Well you can name sprites and duplicate and you could do iteration by using multiple sprites and global variables - that might avoid the problem of repetitive code clutter due to inability to black box (name code and call it by its name) on a single sprite

There are a couple of relevant articles about this from Papert/ Turkle and Resnik - on the topic of epistemological pluralism

My blog was an initial response to scratch, not knowing it very well, I'll try to post again after doing some more complex shapes from the Barry Newell sheet. I have done a couple of his complex shapes now with scratch using repeats inside repeats. Personally, I don't like it as much as abstraction through black boxing - but it's OK so far.