Print

Print


The code you provided doesn't use mySpace at all.  Are you doing something unusual in your Agent6 constructor?

> On Jan 26, 2018, at 10:04 AM, Stewart Aitken <[log in to unmask]> wrote:
> 
> I have a query about ObjectGrid2D(x, y), here is a snippet of code.
> 
> public void buildModel() {
>        mySpace = new ObjectGrid2D(45,20);
>        agents = new Bag();
>        for (int i=0; i<initNumberOfAgents; i++) {
>            agents.add(new Agent6(this));
>        }
>    }
> I am creating different size grids in rectangular form with the same amount of cells as the square grid.
> The code is a rectangle for 900 cells and the square has x =  30 and y = 30. 
> 
> The square cells can all be accessed. I had assumed that a rectangle with x = 20 and y = 45 would work as well.
> However it does not. If I place the 20 in the x position then the agents as they fill the grid only fill to y == 19 which is 20 and then jumps to y == 0.
> 
> After a while I rearanged the x, y to y, x and once again the agents can access all cells.
> 
> I have looked in manual 19 and not found that ObjectGrid2D(x, y) is correct. it will be helpful if it can be confirmed either way.
> 
> all the best,
> 
> Stewart.