No registered users in community xowiki
in last 10 minutes
in last 10 minutes
[Xotcl] Re: Simple example: TicTacToe
From: Gustaf Neumann <neumann_at_wu-wien.ac.at>
Date: Tue, 13 Mar 2001 00:16:56 +0100
On Monday 12 March 2001 23:44, you wrote:
> Hello all.
>
> I was having some trouble understanding basic things about XOTcl. I found
> an old TicTacToe program written in OTcl (by Gustaf?) and translated it so
> it would run on Tk rather than Mofe.
no, the program was implemented by Ralf Goertzen, who was
teaching assistent in my former department in Essen. The only
piece of code of this example is the pseudo-random number
generator....
> It's self-contained, involves several
> cooperating objects, and has a simple domain. Maybe some other beginner
> would find going through it useful.
>
> I have attached the script to this mail message.
What you did is a very straightforward translation from
OTcl to XOTcl and does therefore not use any new functionality
of xotcl. One example are the names of the objects.
In OTcl, all object names have to be global, XOTcl supports
aggregation. I would recommend to create the engine, the
gameport, etc. into the game object. This will make it possible
to create e.g. 2 instances of the game, without interfering with
each other, or this will allow you to remove a game instance
with everything that belongs to it by a single command...
best regards
-gustaf
Date: Tue, 13 Mar 2001 00:16:56 +0100
On Monday 12 March 2001 23:44, you wrote:
> Hello all.
>
> I was having some trouble understanding basic things about XOTcl. I found
> an old TicTacToe program written in OTcl (by Gustaf?) and translated it so
> it would run on Tk rather than Mofe.
no, the program was implemented by Ralf Goertzen, who was
teaching assistent in my former department in Essen. The only
piece of code of this example is the pseudo-random number
generator....
> It's self-contained, involves several
> cooperating objects, and has a simple domain. Maybe some other beginner
> would find going through it useful.
>
> I have attached the script to this mail message.
What you did is a very straightforward translation from
OTcl to XOTcl and does therefore not use any new functionality
of xotcl. One example are the names of the objects.
In OTcl, all object names have to be global, XOTcl supports
aggregation. I would recommend to create the engine, the
gameport, etc. into the game object. This will make it possible
to create e.g. 2 instances of the game, without interfering with
each other, or this will allow you to remove a game instance
with everything that belongs to it by a single command...
best regards
-gustaf