001 import swarm.space.*;
002 import swarm.*;
003 import swarm.defobj.*;
004
005 public class FoodSpace extends Discrete2dImpl{
006 public FoodSpace(Zone aZone,int x,int y){
007 super(aZone,x,y);
008 }
009
010 public Object seedFoodWithProb(double seedProb){
011 int x,y;
012 int xsize,ysize;
013
014 xsize=this.getSizeX();
015 ysize=this.getSizeY();
016
017 for (y = 0; y < ysize; y++)
018 for (x = 0; x < xsize; x++)
019 if(Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0,1.0)<seedProb)
020 this.putValue$atX$Y(1,x,y);
021 return this;
022 }
023 }