Reverse Game in Etoys (was: Re: [Newbies] Reverse Game in seven lines)

David Corking lists at dcorking.com
Thu Jul 13 14:40:12 UTC 2006


On 7/13/06, Markus Gaelli <gaelli at emergent.de> wrote:

> 1. why/how do all the buttons run the same
> scripts?
>
> Etoys is a nice implementation of prototype systems as it stems back from
> "self".
> That means, that you can create shallow copies of any morph using
> "siblings...".
> So I created one cell, and then via red menu halo "Siblings..." -> "Create
> multiple Siblings..." I created another 8 siblings of this one.
>
> A script done for one morph then also applies to all its siblings. If you
> change that script, all siblings change their behavior also, as they share
> the very same script.

A very useful lesson - thank you Markus.  This is looks quite
different from the class methods of some other object systems.

> 2. where is the HelperStack?
>
> This is the one behind the ReverseStack. (The one where you can only see the
> orange outline, I should have denoted it...)
>
> In Etoys you can only program visual objects.
> Thus I used that HelperStack to put in the cell at the cursor of the
> ReverseStack (which always denotes the first cell) until the clicked cell is
> at the first position.
> As the cells are always included at the last position of the HelperStack
> (using the default include: method) and afterwards included at the first
> position of the ReverseStack
> (using the includeAtCursor: method) the cells get reversed.
>
> But I agree, as long as Etoys do not provide a visual debugger, where one
> could watch each step animated, it is hard to understand what is going on.
> For a start you could drag (thus disable) the
> "HelperStack tellAllContents: includeInReverseField"-tile out of its script
> to actually see the cells in the ReverseStack after pressing some cell.

I should have put a break point in there as well - I put Squeak in an
infinite loop all over again.  Anyway - I see your trick now!

> In overenthusiastic clicking, I delete a ScriptStatusControl and break
> the toy :( ('Message not understood' dialog whenever I click on a
> number cell.)  I decide this is another learning opportunity.  A
> couple of minutes clicking around and I haven't found out how to give
> the broken script a new status control.  I googled aound a bit for
> docs, but I know too little about Squeak to know what to ask Google.
> Next I try to make a new tile script from scratch (monkey see - monkey
> do)
>
> Oops! I accidentally click on a 'send message' (! bang) button, and
> Squeak goes into a busy loop.  The screen is not updating at all, and
> my processsor is at 100% for 3 or 4 minutes.  Finally, my processor
> load goes back to normal, but still nothing is happening in the Squeak
> window.
>
> If you are not in the browser Ctrl-. could work to interrupt a process -
> otherwise it might be the best to just restart and reload... :-/

Without labouring a point that has been discussed many times, this
kind of defeats the concepts of persistence of objects in the Squeak
image and independence from the host operating system. - if a child
had lots of artwork in their project, they would have to save an image
or a project file regularly, so they could backtrack in case I come
along and break the project.    Which is best - project file or
changeset or image file?

>  I still don't know the answers to my first two questions.  I
> have more sympathy with Chris Cunnington.
>
>
> This project is intended to show (off ;-) what could be done with Etoys and
> really pushing its limits.
> I guess it is less suited as a general intro, but - who knows?

You are right - there is a lot more in here than in the 'Drive a Car'
toy.  And, you hid the Navigator and Supplies flaps to further confuse
a beginner :)

But, it would be a good way to learn about ideas like sorting, arrays,
and, if I understand it correctly, an event driven approach to
applying the same action to multiple objects  (this is very
fashionable in the current world of Service Oriented Architecture and
'middleware' ... but it probably has general application to
computation, problem-solving and domain modelling for children.)



More information about the Squeak-dev mailing list