This commit is contained in:
Oliver
2021-12-13 15:21:05 +01:00
commit 09a995eccf
8 changed files with 170 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
public interface ILife {
// Methoden zum Setzen der Ausgangssituation
public void nukeAll();
public void setAlive(int x, int y);
public void setDead(int x, int y);
// Methoden zum Abfragen der aktuellen Situation
public boolean isAlive(int x, int y);
// Methoden zum Fortschreiben der Generationen
public ILife nextGeneration();
}
+55
View File
@@ -0,0 +1,55 @@
public class Life implements ILife {
public static void main(String[] args) {
Life l = new Life(new String[] { " ",
" ",
" *** ",
" ",
" " });
l = (Life) l.nextGeneration();
}
public Life() {
nukeAll();
}
public Life(String[] setup) {
this();
for (int y = 0; y < setup.length; y++)
for (int x = 0; x < setup[y].length(); x++)
if (setup[y].charAt(x) != ' ')
setAlive(x, y);
}
@Override
public void nukeAll() {
// TODO Auto-generated method stub
}
@Override
public void setAlive(int x, int y) {
// TODO Auto-generated method stub
}
@Override
public void setDead(int x, int y) {
// TODO Auto-generated method stub
}
@Override
public boolean isAlive(int x, int y) {
// TODO Auto-generated method stub
return false;
}
@Override
public ILife nextGeneration() {
// TODO Auto-generated method stub
return null;
}
}