Stewart Your X and Y coordinates are reversed when you construct mySpace. The correct code is: mySpace = new ObjectGrid2D(20,45); This is why, when you add to the grid in the X dimension (incrementing x), it has wrapped around at y == 20. Russ On 1/26/18, 7:04 AM, "MASON Multiagent Simulation Toolkit on behalf of Stewart Aitken" <[log in to unmask] on behalf of [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.