diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..35eb1ddfbbc029bcab630581847471d7f238ec53 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="" vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/src/main/java/org/example/chaosgame/controller/ChaosGameController.java b/src/main/java/org/example/chaosgame/controller/ChaosGameController.java index cb8678ba34d88366259e2af8b082804b159dec34..0aaeedbe10af2c2a38c19e156408727c84f149a2 100644 --- a/src/main/java/org/example/chaosgame/controller/ChaosGameController.java +++ b/src/main/java/org/example/chaosgame/controller/ChaosGameController.java @@ -148,7 +148,8 @@ public class ChaosGameController implements Observer, Subject, GameController { Double.parseDouble(coords.get(3))); updateChaosGame(new ChaosGameDescription(min, max, - chaosGame.getDescription().getTransforms())); + chaosGame.getDescription().getTransforms(), + chaosGame.getDescription().getProbabilities())); } catch (NumberFormatException e) { AlertUtility.showErrorDialog("Invalid input", "Please enter a valid number."); diff --git a/src/main/java/org/example/chaosgame/model/chaos/ChaosGameDescription.java b/src/main/java/org/example/chaosgame/model/chaos/ChaosGameDescription.java index 8c7177f940833f147f256ae1eea7b859cd1983a2..cd4056afcdb02952946c35a7210b684494b3f232 100644 --- a/src/main/java/org/example/chaosgame/model/chaos/ChaosGameDescription.java +++ b/src/main/java/org/example/chaosgame/model/chaos/ChaosGameDescription.java @@ -53,7 +53,7 @@ public class ChaosGameDescription { throws IllegalArgumentException { validateCoordinates(minCoords, maxCoords); validateTransforms(transforms); - if (probabilities.size() != transforms.size()) { + if (probabilities != null && probabilities.size() != transforms.size()) { throw new IllegalArgumentException("Probabilities must match the number of transformations"); } this.minCoords = minCoords;