-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8a5db7
commit 56beeda
Showing
22 changed files
with
49 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea/* | ||
*.iml | ||
test/* | ||
test/* | ||
out/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"width": 50, | ||
"height": 50, | ||
"jungleRatio": 0.05, | ||
"moveEnergy": 1.0, | ||
"initialEnergy": 100.0, | ||
"plantEnergy": 50.0, | ||
"initialAnimals": 10 | ||
} |
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package sample; | ||
|
||
import org.json.simple.JSONArray; | ||
import org.json.simple.JSONObject; | ||
import org.json.simple.parser.JSONParser; | ||
import org.json.simple.parser.ParseException; | ||
import simulation.InvalidStartingParametersException; | ||
import simulation.Simulation; | ||
|
||
import java.io.IOException; | ||
import java.io.StringReader; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
|
||
public class ParametersLoader { | ||
public static Simulation load(String path) throws IOException, ParseException, InvalidStartingParametersException { | ||
System.out.println(Path.of(path).toAbsolutePath()); | ||
String string = Files.readString(Path.of(path)); | ||
|
||
JSONParser parser = new JSONParser(); | ||
JSONObject jsonObject = (JSONObject) parser.parse(string); | ||
return new Simulation( | ||
"simulation", | ||
((Long) jsonObject.get("width")).intValue(), | ||
((Long) jsonObject.get("height")).intValue(), | ||
(Double) jsonObject.get("jungleRatio"), | ||
(Double) jsonObject.get("moveEnergy"), | ||
(Double) jsonObject.get("plantEnergy"), | ||
((Long) jsonObject.get("initialAnimals")).intValue(), | ||
(Double) jsonObject.get("initialEnergy") | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,5 @@ | |
import javafx.scene.image.Image; | ||
|
||
public interface Tile { | ||
public Image getImage(); | ||
Image getImage(); | ||
} |