Sender: |
|
Date: |
Mon, 19 Mar 2012 09:53:05 -0400 |
Reply-To: |
|
Subject: |
|
MIME-Version: |
1.0 |
Content-Transfer-Encoding: |
7bit |
In-Reply-To: |
|
Content-Type: |
text/plain; charset=UTF-8; format=flowed |
From: |
|
Parts/Attachments: |
|
|
I'm starting out again with Mason and will appreciate some help with
what I expect are fairly simple questions.
I'm transferring a Coordination Game model from Ascape to Mason.
The Ascape code is described here, if anyone's interested -
http://ascape.sourceforge.net/manual/Section3.html
In Mason, I'm using the Schoolyard model as a starter.
In Coordination Game, each agent needs a variable for its color.
I'm trying something like this (I don't think I'm implementing Mason
SimpleColorMap correctly):
public class CoordinationPlayer implements Steppable
{
//public static final double MAX_FORCE = 3.0;
protected SimpleColorMap colormap = new
SimpleColorMap(0,1,Color.black,Color.white);
public Color color;
public MersenneTwisterFast random = new MersenneTwisterFast();
public CoordinationPlayer()
{
if (random.nextInt(2) == 0)
color = Color.red;// colormap.getColor(.2);
else color = Color.yellow; //colormap.getColor(.7);
}
public Color getColor()
{
return color;
}
In CoordinationGameWithUI, - the color is displayed here, in this
hybrid code from the Schoolyard model.
I'm trying to set the color with setPortryalForClass, where each class
object has its own color.
This isn't working correctly:
public void setupPortrayals()
{
CoordinationPlayers students = (CoordinationPlayers) state;
yardgridPortrayal.setField(students.yardgrid);
I'M TRYING TO SET THE COLOR HERE:
yardgridPortrayal.setPortrayalForClass(CoordinationPlayer.class,
new
RectanglePortrayal2D(CoordinationPlayer.getColor(),true)); //new
RectanglePortrayal2D(Color.red,true));
yardgridPortrayal.setPortrayalForNull(new
RectanglePortrayal2D(Color.blue,true));
Thanks for any help -
Randy Latimer
|
|
|