Hey Greenfoot-Community
For school I have to create Conway's Game of Life in Greenfoot. The only thing I have already created is the world. But I really don't know what to do now. How can I tell a cell to check, if his neighbour is dead or alive, or how many neighbours are dead or alive? I'm not really trust with Greenfoot so for me its quite hard and my teacher just said: "If you can't create this, you will get a bad mark!"
Please help me.
This is the world:
import greenfoot.*; // imports Actor, World, Greenfoot, GreenfootImage import java.util.Random; public class GameOfLife extends World { int getHeight; int getWidth; int a; String line; public GameOfLife() { super(50, 50, 10); setBackground("GameOfLife.png"); populate(); } public void populate() { for (int i = 0; i < 50; i++) { for (int j = 0; j < 50; j++) { int zufall = Greenfoot.getRandomNumber(100); if (zufall < 50) { lebendigeZelle lebZ = new lebendigeZelle(); addObject(lebZ,i,j); } else { toteZelle z = new toteZelle(); addObject(z,i,j); } } } } }