[ANN] Tic Tac Toe with Etoys

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ANN] Tic Tac Toe with Etoys

Markus Gälli-3
Hi folks,

(a bit daring to send it to so many people/lists, but I guess that one  
reason why not so much technical related etoys stuff is sent, is  
because people are too shy to send their comments to more than one  
list, so I hope this is ok...;-))

After some experiments I found the trick to do a Tic Tac Toe-game  
entirely with Etoys.
At least a version with human only players, but I nevertheless want it  
to share with you:

http://www.squeakland.org/project.jsp?http://www.squeakalpha.org:8080/ 
super/uploads/TicTacToe.002.pr

It is altogether 43 lines of code, including the script-headers.

The idea is to draw some morphs (polygons) which represent the winning  
lines. When a stone is set, the polygons are asked if they overlap it.
If yes, they add the value of this stone to their internal counter, if  
this counter is not 0 and divisible by 3 we have a winning situation.
The cross is worth +1 and the circle worth -1.
Also the number of already set stones is counted so that a draw can be  
detected.
Enhancing this to 4x4 is quite easy, at least if 4 in a row shall win  
then.

But if someone has any idea for Gomoku without ending up by having to  
draw a zillion of lines, I'd be interested.
One idea in that direction would be to give players some kind of  
"radar", where they could look in some specific direction so that they  
can see all their neighbors (of some kind?)
  in a distance of 1 to n cells, assumed they live in a matrix of cells.  
As directions there would be only vertical, horizontal and diagonal.
Simulations like the game of life and general cellular automatons  
should become very easy to do with this approach, so anybody up to give  
our deaf, dumb and blind players some fast sensors? I did a first  
prototype for that, which is darn slow, but I'd be happy to share that  
code for making it fast.
Or are there other tricks/views concerning this problem on the way?

Have fun,

Markus Gaelli

For a funny tic tac toe with an analogue computer opponent see:
http://www.rci.rutgers.edu/~cfs/472_html/Intro/TinkertoyComputer/ 
TinkerToy.html