--- Scott Rossi <[EMAIL PROTECTED]> wrote:

> > is there an example anywhere?
> > sounds like neural networking.
> > or artificial life.
> 
> It can be.  Here's a simple example that
> demonstrates the "intelligence"
> principle -- a stack that brings five graphic
> objects to life and kills them
> with the push of a button.
> 
> 1) Create a new stack
> 
> 2) Create two buttons: "Master" and "Give
> Life"; position these at the
> bottom of the card
> 
> 3) Create 5 small oval draw graphics and
> position them at various locations
> on the card
> 
> 4) Place this script in button "Master":
> on mouseUp
>   # THIS ALLOWS EASY EDITING OF THE MASTER
> SCRIPT FOR ALL SPRITE OBJECTS
>   if short name of me is "master" then edit
> script of me
> end mouseUp
> 
> on activateMe
>   set the uAllowLife of me to true
>   set the uRate of me to "3,3"
>   set the uLimits of me to rect of this cd
>   moveMe
> end activateMe
> 
> on moveMe
>   if not the uAllowLife of me then exit moveMe
>   # MANAGE HORIZONTAL MOVEMENT
>   if item 1 of the uRate of me > 0 then
>     if right of me > item 3 of the uLimits of
> me then
>       set the uRate of me to ("-3," & item 2 of
> the uRate of me)
>     end if
>   else
>     if left of me < item 1 of the uLimits of me
> then \
>        set the uRate of me to "3," & item 2 of
> the uRate of me
>   end if
>   # MANAGE VERTICAL MOVEMENT
>   if item 2 of the uRate of me > 0 then
>     if bottom of me > item 4 of the uLimits of
> me then
>       set the uRate of me to (item 1 of the
> uRate of me & ",-3")
>     end if
>   else
>     if top of me < item 2 of the uLimits of me
> then \
>        set the uRate of me to (item 1 of the
> uRate of me & ",3")
>   end if
>   put the loc of me into tLoc
>   add item 1 of the uRate of me to item 1 of
> tLoc
>   add item 2 of the uRate of me to item 2 of
> tLoc
>   set loc of me to tLoc
>   send "moveMe" to me in 10 milliseconds
> end moveMe
> 
> on killMe
>   set the uAllowLife of me to false
> end killMe
> 
> 
> 5) Place this script in button "Give Life":
> on mouseUp
>   set the uLife of me to not the uLife of me
>   if the uLife of me then
>     repeat with x = 1 to 5
>       set script of grc x to script of btn
> master
>       send "activateMe" to grc x in (x*200)
> milliseconds
>     end repeat
>   else
>     repeat with x = 1 to 5
>       send "killMe" to grc x
>     end repeat
>   end if
> end mouseUp
> 
> -----
> 
> Click the "Give Life" button.  You should see
> the ball "sprites" come to
> life one at a time and bounce.  When each ball
> senses the edge of the screen
> it will change direction.  Click the "Give
> Life" button again to kill all
> movement.  By adding random/changing values to
> the move rates and timing,
> you can create some intricate/organic movement
> that is handled individually
> by each sprite being "self aware".

thanks,
this will take time to ponder.
there must be a tie in with Turtle Graphics.

=====
[EMAIL PROTECTED]    http://www.erikhansen.org

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com
_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to