swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Swarm programming question (sounds like "I'm getting tired of objects")


From: glen e. p. ropella
Subject: Swarm programming question (sounds like "I'm getting tired of objects")
Date: Wed, 26 Nov 1997 06:29:21 -0700

Paul Johnson writes:
 > Here it is. I'm frustrated that all of these swarm methods require you
 > pass them an id or object instead of real numbers or arrays (the C kind,
 > not the swarm kind).  Here is the latest example.  I have a typedef that
 > creates an array, as in int[2], called dimarray. I did that because I want
 > to pass points in space back and forth between objects without separately
 > specifying the X and the Y coordinates as arguments, as is done in so many
 > swarm examples.  This type, called "dimarray" in my code, can be cast as
 > an id without apparent damage, so when the getselector methods are needed
 > in modelActions or such--you know, M(:)::,you can cast dimarray types as
 > id and you don't get errors at compile or runtime.

Have you thought of making the "point" an object in and of
itself?  Instead of using an array, you could be using a 
point in space that has it's own state (it's coordinates plus
any accounting variables you might need) and rules (dictating
display, motion, etc).  This is what Nelson recommended in 
the FUTURE-DESIGN text in the space library and, I think, what
Ken Cline has done.  There are numerous problems with this 
mechanism, though.

 > But now I'm a bit baffled when it comes to drawing things like this on a
 > 2d zoomRaster.  I've copied the approach in heatbugs or the tutorial to
 > put all the coordinates of one class of objects on the screen. In my
 > example, these points show the ideal points of the voters in a
 > majority rule election.  The code offers these voters pairs of
 > alternatives, they say which they like best, and that is the winner.
 > That winner is represented as a dimarray called "current" and then
 > proposals are put up against it over and over.  The printf reports 
 > the calculations are fine. However, I can't figure how to make that point,
 > of type dimarray, march around on the screen.
 > 
 > To let you know I'm trying to work this out, here is the way I'm guessing
 > you Swarm types would do it. You create a new id type
 > object--outcomeList-- and use the usual methods to make it a List (as in
 >  bugList or such).  You have to then create an object to monitor the
 > election and grab the "current" point. Then you addLast that monitor
 > object to the outcomeList.   Then you hold a new election, create a new
 > monitor object, have it get the "current" point, and add it to the
 > outcomeList.  
 > 
 > When you do the zoomRaster, the outcomeList is passed, and assuming you
 > write "drawSelfOn" methods for the type of objects in outcomeList, then 
 > the display ought to show a series of election outcomes.

OK.  So, rather than put the "display" functionality inside the
dimarray, you intend to provide a kind of "proxy" to the dimarray
via this "monitor" object?  Do you provide a single monitor for
each single winning dimarray?  If so, then you're not gaining
anything over the method of making the dimarray a full-fledged
object with the capability of displaying itself.

 > I'm just asking because this seems like a very circuitous route.  I keep
 > looking at the Array in Swarm and trying to figure how it can be used, but
 > there just aren't enough examples.

It is circuitous.  I would suggest the following ways of doing it:

1) make the dimarray an object, give it the ability to draw
   itself on a raster, then put the winners in a list to which
   the schedule will send a createActionForEach: message.  The
   membership of the list will change over time.

2) Since you're using a raster instead of a graph or some other
   nonspatial display device, I assume you think there's some
   spatial relationship to the options that get selected.  If
   you consider the voting alternatives objects instead of 2d
   arrays and then give those objects the capabilities of navigating
   a 2d space, then you can simply use space like heatbugs does.
   The "current" point will be placed in the space and Object2dDisplay
   can take care of showing those objects on the raster.  If
   you would like to keep track of the losers, as well, then you
   can have 2 spaces, a winner space and a loser space.

 > PS. I just installed the KDE window manager (beta 2) and find it to be
 > excellent and high in functionality.  Compared to some of the others that
 > optimize color gradients and beauty, this one actually offers many
 > features that will be useful! Put icons on screen to start programs,
 > easily configure program defaults, and such.  I don't know how KDE
 > exists, makes a living, or why, but I have to say they do nice work.

Is it free?  Is there an ftp site for it?

glen
-- 
{glen e. p. ropella <address@hidden> |  Send lawyers, guns, and money!  }
{Hive Drone, SFI Swarm Project         |            Hail Eris!            }
{http://www.trail.com/~gepr/home.html  |               =><=               }

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]