diff --git a/Sd1/P/crab/V1/pom.xml b/Sd1/P/crab/V1/pom.xml index 4d2df609d2b3ea50c5046f1eaee6946312199723..97b9d798241efd313db3dbab46d8650ac757a3e6 100644 --- a/Sd1/P/crab/V1/pom.xml +++ b/Sd1/P/crab/V1/pom.xml @@ -38,9 +38,9 @@ </links> <additionalDependencies> <additionalDependency> - <groupId>org.greenfoot</groupId> - <artifactId>greenfoot-core</artifactId> - <version>2.5</version> + <groupId>de.hdm-stuttgart.mi</groupId> + <artifactId>greenfoot</artifactId> + <version>2.3.0</version> </additionalDependency> </additionalDependencies> </configuration> @@ -64,5 +64,10 @@ <version>4.11</version> <scope>test</scope> </dependency> + <dependency> + <groupId>de.hdm-stuttgart.mi</groupId> + <artifactId>greenfoot</artifactId> + <version>2.3.0</version> + </dependency> </dependencies> </project> diff --git a/Sd1/P/crab/V2/pom.xml b/Sd1/P/crab/V2/pom.xml index c641bb1841c9f992a1d5c600c51e89c557788157..f6f769afd8e3f2b64fe854331c52de903cdc8a12 100644 --- a/Sd1/P/crab/V2/pom.xml +++ b/Sd1/P/crab/V2/pom.xml @@ -38,9 +38,9 @@ </links> <additionalDependencies> <additionalDependency> - <groupId>org.greenfoot</groupId> - <artifactId>greenfoot-core</artifactId> - <version>2.5</version> + <groupId>de.hdm-stuttgart.mi</groupId> + <artifactId>greenfoot</artifactId> + <version>2.3.0</version> </additionalDependency> </additionalDependencies> @@ -65,5 +65,12 @@ <version>4.11</version> <scope>test</scope> </dependency> + + <dependency> + <groupId>de.hdm-stuttgart.mi</groupId> + <artifactId>greenfoot</artifactId> + <version>2.3.0</version> + </dependency> + </dependencies> </project> diff --git a/Sd1/P/life/V3/pom.xml b/Sd1/P/life/V3/pom.xml index 03e0d7775d1abfe71489b3a907fb355239d3af33..3de816165dfdc5a1d674499eacd47eec56f558b7 100644 --- a/Sd1/P/life/V3/pom.xml +++ b/Sd1/P/life/V3/pom.xml @@ -36,15 +36,13 @@ <links> <link>http://www.greenfoot.org/files/javadoc/</link> </links> -<!-- <additionalDependencies> <additionalDependency> - <groupId>org.greenfoot</groupId> - <artifactId>greenfoot-core</artifactId> - <version>2.5</version> + <groupId>de.hdm-stuttgart.mi</groupId> + <artifactId>greenfoot</artifactId> + <version>2.3.0</version> </additionalDependency> </additionalDependencies> ---> </configuration> </plugin> @@ -69,8 +67,8 @@ </dependency> <dependency> <groupId>de.hdm-stuttgart.mi</groupId> - <artifactId>greenfoot</artifactId> - <version>2.3.0</version> + <artifactId>greenfoot</artifactId> + <version>2.3.0</version> </dependency> </dependencies> </project> diff --git a/Sd1/P/life/V3/src/main/java/Cell.java b/Sd1/P/life/V3/src/main/java/Cell.java index ce0768ed3b07376aa8f5736558d4ba95f3162377..abc4a54aaee10469773f7f74f141319645559024 100755 --- a/Sd1/P/life/V3/src/main/java/Cell.java +++ b/Sd1/P/life/V3/src/main/java/Cell.java @@ -27,7 +27,6 @@ public class Cell extends Actor { /** * Create the cell body's image and initialize state. * - * @param cellSize The cell's size in pixel units, * @param intialState Indicating {@link CellState#ALIVE} or {@link CellState#DEAD} */ public Cell(final CellState intialState) { @@ -67,6 +66,9 @@ public class Cell extends Actor { previousState = currentState; } + /** + * @return Number of living neighbouring cells + */ public int getLivingNeighbourCount() { int sum = 0; for (final Cell neighbor: neighbours) { @@ -75,6 +77,9 @@ public class Cell extends Actor { return sum; } + /** + * Set cell alive + */ public void setAlive() { setState(CellState.ALIVE); } diff --git a/Sd1/P/life/V3/src/main/java/LifeWorld.java b/Sd1/P/life/V3/src/main/java/LifeWorld.java index f714aa0c2b3ad8369737420c2a9aa93c8df5ed94..c47231bd2ee2bb8271c2e047fee0f5d2584c59f8 100755 --- a/Sd1/P/life/V3/src/main/java/LifeWorld.java +++ b/Sd1/P/life/V3/src/main/java/LifeWorld.java @@ -10,17 +10,25 @@ import java.awt.Color; * */ public class LifeWorld extends World { - + static private final int initialLivingPercentage = 25 ,width = 80 ,height = 50; + /** + * default cell size + */ public static final int cellSize = 10; // Minimum of 3 pixel in width here yields a (cellSize-2)x(cellSize-2) pixel visible cell - static public GreenfootImage - imageAlive = new GreenfootImage(cellSize, cellSize) - ,imageDead = new GreenfootImage(cellSize, cellSize); + /** + * image of living cell + */ + static public GreenfootImage imageAlive = new GreenfootImage(cellSize, cellSize); + /** + * image of dead cell + */ + static public GreenfootImage imageDead = new GreenfootImage(cellSize, cellSize); // "Class" constructor initializing static fields. You may want to read Ivor Horton's // "Using Initialization Blocks" / "Initializing Data Members" subsection. @@ -163,7 +171,7 @@ public class LifeWorld extends World { } /** Randomly return the two states {@link CellState#ALIVE} and {@link CellState#DEAD}. The - * corresponding probabilities are {@link #setInitialLivingPercentage(int)} / 100 and + * corresponding probabilities are initialLivingPercentage/100 and * its complement. * * @return Either {@link CellState#ALIVE} or {@link CellState#DEAD}.