Partial List of Etoy Projects

Dreyfuss Pierre-Andre (EDU) pierre-andre.dreyfuss at
Mon Feb 17 21:28:51 PST 2003

Hi, I'm new with E-Toys but working from some times with kids 12 - 15 years

I made tic tac toe with differents laguages, logo , toontalk and the last
one was Delphi and I'll just start doing it with E-Toys.

First step is to build the interface.
Use a text to show who's turn to play. Name this text 'turn'
This text will show x then o then x ...
So write the script 'next' which is changing x into O or O into x.
This is done with a test tile. 
Something like 

test turn's character = 'x'
  yes : turn's character <- 'o'
  no  : turn's character <- 'x'

Take another text and name it 'cell'
Build just a cell (you'll copy this cell when it is working to get the 9

You can define a script which should be fired with mouseup.
If you try to mouseup on the text you'll just open the text for editing,
since the mouse is already used for that.
But the script will work if it receives a mouseup message from the tile
The solution is to cover the text with a transparent playfield embeded in
the text.
Make a little square with a playfield, using the color halo button set
translucent to 0. The square is transparent put it on the text and use the
menu embeded to embeded it in the cell.
Now write a script in the cell

cell's character <-- turn's character.
turn's next

set normal to mouseup for this script.

write a script into the playfield with 

cell's fire in it.

Set normal to mouseup for this script

now copy this object using the green halo button to make the 9 cells.

We need to make a button to clear the cells.

Use a press me button and the green point in the bottom of its halo.
Turn the script to tile  (click the black square on the right of the round
collaspse button.

Then for each cell get the tile character <--  and put a space  as value.

cell's character <- ' '
cell1's character <- ' '


and so on.

Now two humans can play tic tac toe.
Up this point I did it with squeak while writing this script  and it is

Now I just describe what should be done . 

Step 2  We want to change in upper case a whole line of X  or O.

To do this we have to make 8 scripts one for each line
and probably 8 for the three  X and eight for the three O.

We have to avoid playing in a cell containing something different of a

step 3
If you succeed watching lines of three x or three o,

then it will be not too difficult to search lines with two x and a space
or lines with two o and a space.

Now the algorithm for the computer.

First search if the computer has a line with two marks and a space.
if yes just play at the place of this space and computer win.

If not search a line with two marks to avoid  loosing.

If not try to play at center 

if not try a corner
if not try the middle of rows.

If the computer starts you'll get null. 
If you starts you have a chance to win.

You can improve this searching other specials lines.
But remember if the computer is playing the best way , there is no more
play, (see the movie War game ).
 There is no Winner, only null play.

Best regards
P-A Dreyfuss

PS I'll post next week the addfrench method I have wrote to translate 
the scripts into french.

-----Message d'origine-----
De: Alan Kay
A: squeakland at
Date: 15.02.03 05:56
Objet: Re: Partial List of Etoy Projects

Do you have a good algorithm or strategy for TicTacToe? Let me know 
and I'll see what I can do. There are some very interesting 
distributed system approaches that might be good here -- somewhat 
similar to the biological tree growing schemes in etoys that don't 
require recursion, but are "recursive" none the less.




At 1:50 PM +0100 2/14/03, Karl Ramberg wrote:
>Alan Kay wrote:
>>Our impression is that most folks who have started in etoys have 
>>tended to stay with projects that are like the examples given on 
>>the website and have not gone much beyond those examples. This is 
>>just to point out that there are lots of really interesting 
>>mathematical, scientific and theatrical projects for which etoys 
>>are a pretty neat authoring environment.
>Have anybody done a TicTacToe or FourInARow type of game in etoys?
>I have been poundering with the idea a while and have not yet found
>good way to make this kind of algorithms in etoys.


More information about the Squeakland mailing list