Subato

Resource Files

Ein Klassiker: Conways Spiel des Lebens

In dieser geht es um die Arbeit mit einer mehrdimensionalen Reihung.

Studieren Sie den zur Aufgabe gehörenden Lehrbrief und lösen Sie die Aufgaben darin. Testen Sie ihre Lösungen zunächst am besten interaktiv in der JShell.


record GameOfLife(boolean[][] field){ String show(){ return ""; } int population(){ //To Do return 0; } boolean extinct(){ //To Do return false; } static GameOfLife fromString(String m){ //To Do } static String ex1 = """ .................. .................. .................. .................. ......0....0...... ....00.0000.00.... ......0....0...... .................. .................. .................. .................."""; int anzahlBelegterNachbarn(int x, int y){ //ToDo return 0; } GameOfLife nextGeneration(){ } void waitAndClear(){ try{Thread.sleep(2000);}catch(Exception e){} System.out.print("\033[H\033[2J"); System.out.flush(); } void play(){ var current = this; } public static void main(String... args){ GameOfLife.fromString(GameOfLife.ex1).play(); } }
java
You are not logged in and therefore you cannot submit a solution.