Print

Print


I have a FastObjectGridPortrayal2D of objects.  Each cell in the grid
should change colors depending on a property of their respective
objects.  However, the simulation does not change colors during runs
as it should.

I'm doing the following:

- the objects stored in each FastObjectGridPortrayal2D cell is a
Valuable and so declares a doubleValue() that returns a uniformly
random (0,1]

- where I set up portrayals in my SimState I do the following:

        landPortrayal.setField(world.allLand); // world.allLand is an
ObjectGrid2D with each element a Valued and Steppable object
registered with Scheduler

        landPortrayal.setMap(
            new sim.util.gui.SimpleColorMap(
                new Color[] {Color.GREEN, Color.YELLOW}));

   That is, I want (0,1] to map from green to yellow values.

- Each stored object in my FastObjectGridPortrayal2D is a Steppable
and is registered with the scheduler so that its doubleValue()
iterates to the next random double

I have verified that each object is setting doubleValue() to different
random values and not to all zeros; yet all I see is a solid green
block during runs.

What am I doing wrong?

Cheers,

Mark
-- 
Bob Hope  - "You know you are getting old when the candles cost more
than the cake."