This site requires JavaScript, please enable it in your browser!
Greenfoot back
Wavesludge
Wavesludge wrote ...

2012/12/11

Conway's Game Of life

1
2
vonmeth vonmeth

2012/12/11

#
It takes awhile to compile because it is doing a lot. Nothing can really be done about that except decrease the number of cells (which I did, as you can see in the code I posted.) Did you add the saveState method? Did you add it to the constructor?
Wavesludge Wavesludge

2012/12/11

#
OK, makes sense. And yes, I added saveState
public CellularAutomator()  
    {      
        super(555, 555, 1); 
        myHeight = getHeight();  
        myWidth = getWidth();  
        myCellSize = getCellSize();  
        drawGrid();  
        createCells();  
        saveState();
    }  
vonmeth vonmeth

2012/12/11

#
Your cell size is soooooooo small (1 pixel), you won't be able to see anything. That is also a lot of cells - 555x555 = 308025 cells. Which results in huge arrays. This is why it is taking so long to compile. Try something a bit smaller in the width and height of the world, and a bit bigger on the cell size. super(width, height, cell size)
Wavesludge Wavesludge

2012/12/11

#
Yeah, that works. Thanks for the help!
You need to login to post a reply.
1
2