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: Paul Johnson
Subject: Swarm programming question (sounds like "I'm getting tired of objects")
Date: Tue, 25 Nov 1997 10:25:01 -0600 (Central Standard Time)

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.

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.

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.

Paul Johnson
no sig on the new pc yet!

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.


                  ==================================
   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]