Skip to content

Commit

Permalink
Fixed guiDisabled config option and shading issues
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmtech committed Dec 20, 2022
1 parent 37074a9 commit b70ddc9
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 11 deletions.
40 changes: 36 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.justinmtech</groupId>
<artifactId>Game-of-Life</artifactId>
<version>0.7</version>
<version>0.8</version>

<name>Game of Life</name>
<description>Simulate cell life and create art from seeds.</description>
Expand Down Expand Up @@ -54,24 +54,56 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/LICENSE</exclude>
</excludes>
</filter>
<filter>
<artifact>com.fasterxml.jackson.core:*</artifact>
<excludes>
<exclude>META-INF/services/com.fasterxml.jackson.core.ObjectCodec</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>2.13.4</version>
<version>2.14.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.4.2</version>
<version>2.14.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.justinmtech</groupId>
<artifactId>CellularAutomata</artifactId>
<version>0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand All @@ -89,7 +121,7 @@
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.9.0</version>
<scope>compile</scope>
<scope>test</scope>
</dependency>
</dependencies>

Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/justinmtech/gameoflife/GameOfLife.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class GameOfLife {
public static void main(String[] args) {
ConfigManager configManager = new ConfigManager();
GameConfig gameConfig = configManager.getGameConfig();
System.out.println(gameConfig.toString());
GenerationType generator = gameConfig.getGenerator();
if (generator == GenerationType.DYNAMIC) {
Environment environment = new Environment(configManager);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ private boolean saveDefaultConfigTest() {
config.setRandomDeathChance(100);
config.setUseRandomDeathChance(false);
config.setUseRandomCellColors(false);
config.setGuiDisabled(false);
config.setShowGenerationInConsole(false);
config.setGuiDisabled(false);
config.setConsoleCellDeadDisplay(" ");
config.setConsoleCellAliveDisplay("*");
ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory());
try {
objectMapper.writeValue(new File("config.yaml"), config);
objectMapper.writeValue(file, config);
return true;
} catch (IOException e) {
e.printStackTrace();
Expand Down
12 changes: 7 additions & 5 deletions src/main/java/com/justinmtech/gameoflife/config/GameConfig.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.justinmtech.gameoflife.config;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.justinmtech.gameoflife.generation.GenerationType;

import java.util.Arrays;
Expand All @@ -19,10 +20,11 @@ public class GameConfig {
private String backgroundColor;
private String cellColor;
private boolean useRandomCellColors;
private boolean guiDisabled;
private boolean showGenerationInConsole;
private String consoleCellAliveDisplay;
private String consoleCellDeadDisplay;
@JsonProperty("guiDisabled")
private boolean guiDisabled;

public GameConfig() {}

Expand Down Expand Up @@ -146,6 +148,7 @@ public void setShowGenerationInConsole(boolean showGenerationInConsole) {
this.showGenerationInConsole = showGenerationInConsole;
}

@JsonProperty("guiDisabled")
public boolean isGUIDisabled() {
return guiDisabled;
}
Expand All @@ -172,8 +175,7 @@ public void setConsoleCellDeadDisplay(String consoleCellDeadDisplay) {

@Override
public String toString() {
return "#generator types static/dynamic" +
"\ngenerator: " + generator +
return "\ngenerator: " + generator +
"\nupdateDelay: " + updateDelay +
"\ngenerationChance: " + generationChance +
"\nmaxGenerations: " + maxGeneration +
Expand All @@ -187,9 +189,9 @@ public String toString() {
"\ncellColor: " + cellColor +
"\nuseRandomCellColors: " + useRandomCellColors +
"\nshowGenerationInConsole: " + showGenerationInConsole +
"\nguiDisabled: " + guiDisabled +
"\nconsoleCellAliveDisplay: " + consoleCellAliveDisplay +
"\nconsoleCellDeadDisplay: " + consoleCellDeadDisplay +
"\ngameTitle: " + gameTitle;
"\ngameTitle: " + gameTitle +
"\nguiDisabled: " + guiDisabled;
}
}

0 comments on commit b70ddc9

Please sign in to comment.