Init
This commit is contained in:
@@ -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();
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user