diff --git a/.idea/$PRODUCT_WORKSPACE_FILE$ b/.idea/$PRODUCT_WORKSPACE_FILE$
new file mode 100644
index 0000000000..67bd976742
--- /dev/null
+++ b/.idea/$PRODUCT_WORKSPACE_FILE$
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000000..ae76635bc3
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+duke
\ No newline at end of file
diff --git a/.idea/CS2113_Project.iml b/.idea/CS2113_Project.iml
new file mode 100644
index 0000000000..d6ebd48059
--- /dev/null
+++ b/.idea/CS2113_Project.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 1cb1c6ae7c..c98f19b1aa 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -2,6 +2,8 @@
+
+
diff --git a/.idea/libraries/Gradle__org_openjfx_javafx_base_win_11_0_2.xml b/.idea/libraries/Gradle__org_openjfx_javafx_base_mac_11_0_2.xml
similarity index 67%
rename from .idea/libraries/Gradle__org_openjfx_javafx_base_win_11_0_2.xml
rename to .idea/libraries/Gradle__org_openjfx_javafx_base_mac_11_0_2.xml
index 81ef68a9fe..762f16ccb9 100644
--- a/.idea/libraries/Gradle__org_openjfx_javafx_base_win_11_0_2.xml
+++ b/.idea/libraries/Gradle__org_openjfx_javafx_base_mac_11_0_2.xml
@@ -1,11 +1,11 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_openjfx_javafx_controls_win_11_0_2.xml b/.idea/libraries/Gradle__org_openjfx_javafx_controls_mac_11_0_2.xml
similarity index 66%
rename from .idea/libraries/Gradle__org_openjfx_javafx_controls_win_11_0_2.xml
rename to .idea/libraries/Gradle__org_openjfx_javafx_controls_mac_11_0_2.xml
index 5842dca523..64ece51420 100644
--- a/.idea/libraries/Gradle__org_openjfx_javafx_controls_win_11_0_2.xml
+++ b/.idea/libraries/Gradle__org_openjfx_javafx_controls_mac_11_0_2.xml
@@ -1,11 +1,11 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_openjfx_javafx_fxml_win_11_0_2.xml b/.idea/libraries/Gradle__org_openjfx_javafx_fxml_mac_11_0_2.xml
similarity index 67%
rename from .idea/libraries/Gradle__org_openjfx_javafx_fxml_win_11_0_2.xml
rename to .idea/libraries/Gradle__org_openjfx_javafx_fxml_mac_11_0_2.xml
index c731cc8360..a2e18921f9 100644
--- a/.idea/libraries/Gradle__org_openjfx_javafx_fxml_win_11_0_2.xml
+++ b/.idea/libraries/Gradle__org_openjfx_javafx_fxml_mac_11_0_2.xml
@@ -1,11 +1,11 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_openjfx_javafx_graphics_win_11_0_2.xml b/.idea/libraries/Gradle__org_openjfx_javafx_graphics_mac_11_0_2.xml
similarity index 66%
rename from .idea/libraries/Gradle__org_openjfx_javafx_graphics_win_11_0_2.xml
rename to .idea/libraries/Gradle__org_openjfx_javafx_graphics_mac_11_0_2.xml
index e3c12ff3c0..8456177416 100644
--- a/.idea/libraries/Gradle__org_openjfx_javafx_graphics_win_11_0_2.xml
+++ b/.idea/libraries/Gradle__org_openjfx_javafx_graphics_mac_11_0_2.xml
@@ -1,11 +1,11 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 8ba5dc7790..3563931bc1 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -2,9 +2,9 @@
-
-
-
+
+
+
diff --git a/.idea/modules/main.iml b/.idea/modules/CS2113_Project.iml
similarity index 60%
rename from .idea/modules/main.iml
rename to .idea/modules/CS2113_Project.iml
index 9ceccfb260..9041885eb8 100644
--- a/.idea/modules/main.iml
+++ b/.idea/modules/CS2113_Project.iml
@@ -1,12 +1,12 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/main.main.iml b/.idea/modules/CS2113_Project.main.iml
similarity index 71%
rename from .idea/modules/main.main.iml
rename to .idea/modules/CS2113_Project.main.iml
index eabda8118f..7b8a97e822 100644
--- a/.idea/modules/main.main.iml
+++ b/.idea/modules/CS2113_Project.main.iml
@@ -1,21 +1,21 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/main.test.iml b/.idea/modules/CS2113_Project.test.iml
similarity index 75%
rename from .idea/modules/main.test.iml
rename to .idea/modules/CS2113_Project.test.iml
index 1047615cbc..de24c398c8 100644
--- a/.idea/modules/main.test.iml
+++ b/.idea/modules/CS2113_Project.test.iml
@@ -1,28 +1,28 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build/classes/java/main/Commands/Command.class b/build/classes/java/main/Commands/Command.class
index 911fbd4365..eb0f41e5dc 100644
Binary files a/build/classes/java/main/Commands/Command.class and b/build/classes/java/main/Commands/Command.class differ
diff --git a/build/classes/java/main/Commands/CommandDayNew.class b/build/classes/java/main/Commands/CommandDayNew.class
index 803e444a20..7d1a779370 100644
Binary files a/build/classes/java/main/Commands/CommandDayNew.class and b/build/classes/java/main/Commands/CommandDayNew.class differ
diff --git a/build/classes/java/main/Commands/CommandGameQuit.class b/build/classes/java/main/Commands/CommandGameQuit.class
index 307f41e51c..115195f5ce 100644
Binary files a/build/classes/java/main/Commands/CommandGameQuit.class and b/build/classes/java/main/Commands/CommandGameQuit.class differ
diff --git a/build/classes/java/main/Commands/CommandMenuStart.class b/build/classes/java/main/Commands/CommandMenuStart.class
index 1a5d3b0b2f..3b190463c3 100644
Binary files a/build/classes/java/main/Commands/CommandMenuStart.class and b/build/classes/java/main/Commands/CommandMenuStart.class differ
diff --git a/build/classes/java/main/Commands/CommandWelcome.class b/build/classes/java/main/Commands/CommandWelcome.class
index 862a90a623..c4e93d5ee1 100644
Binary files a/build/classes/java/main/Commands/CommandWelcome.class and b/build/classes/java/main/Commands/CommandWelcome.class differ
diff --git a/build/classes/java/main/Exceptions/FarmioException.class b/build/classes/java/main/Exceptions/FarmioException.class
index 9e2f4091c8..a6657863c5 100644
Binary files a/build/classes/java/main/Exceptions/FarmioException.class and b/build/classes/java/main/Exceptions/FarmioException.class differ
diff --git a/build/classes/java/main/Exceptions/FarmioFatalException.class b/build/classes/java/main/Exceptions/FarmioFatalException.class
index b0a63b0357..111d39608c 100644
Binary files a/build/classes/java/main/Exceptions/FarmioFatalException.class and b/build/classes/java/main/Exceptions/FarmioFatalException.class differ
diff --git a/build/classes/java/main/Farmio/Farmio$Stage.class b/build/classes/java/main/Farmio/Farmio$Stage.class
index c3caf9d06c..1c7a846976 100644
Binary files a/build/classes/java/main/Farmio/Farmio$Stage.class and b/build/classes/java/main/Farmio/Farmio$Stage.class differ
diff --git a/build/classes/java/main/Farmio/Farmio.class b/build/classes/java/main/Farmio/Farmio.class
index f52a401e9c..858d8210ac 100644
Binary files a/build/classes/java/main/Farmio/Farmio.class and b/build/classes/java/main/Farmio/Farmio.class differ
diff --git a/build/classes/java/main/FrontEnd/AsciiColours.class b/build/classes/java/main/FrontEnd/AsciiColours.class
index 33e599dcb1..ac9a48fe76 100644
Binary files a/build/classes/java/main/FrontEnd/AsciiColours.class and b/build/classes/java/main/FrontEnd/AsciiColours.class differ
diff --git a/build/classes/java/main/Places/ChickenFarm.class b/build/classes/java/main/Places/ChickenFarm.class
index a85f8bf15b..4c052ef545 100644
Binary files a/build/classes/java/main/Places/ChickenFarm.class and b/build/classes/java/main/Places/ChickenFarm.class differ
diff --git a/build/classes/java/main/Places/CowFarm.class b/build/classes/java/main/Places/CowFarm.class
index 27ffd91ac1..e5f371d65a 100644
Binary files a/build/classes/java/main/Places/CowFarm.class and b/build/classes/java/main/Places/CowFarm.class differ
diff --git a/build/classes/java/main/Places/Farm.class b/build/classes/java/main/Places/Farm.class
index 48f1e8b27d..9198cf9af5 100644
Binary files a/build/classes/java/main/Places/Farm.class and b/build/classes/java/main/Places/Farm.class differ
diff --git a/build/classes/java/main/Places/Market.class b/build/classes/java/main/Places/Market.class
index d9244f7932..b09293b13b 100644
Binary files a/build/classes/java/main/Places/Market.class and b/build/classes/java/main/Places/Market.class differ
diff --git a/build/classes/java/main/UserCode/Conditions/BooleanConditionType.class b/build/classes/java/main/UserCode/Conditions/BooleanConditionType.class
index cfabc9eaab..737759bb0e 100644
Binary files a/build/classes/java/main/UserCode/Conditions/BooleanConditionType.class and b/build/classes/java/main/UserCode/Conditions/BooleanConditionType.class differ
diff --git a/build/classes/java/main/UserCode/Conditions/Comparator.class b/build/classes/java/main/UserCode/Conditions/Comparator.class
index b14e8050b4..f516252792 100644
Binary files a/build/classes/java/main/UserCode/Conditions/Comparator.class and b/build/classes/java/main/UserCode/Conditions/Comparator.class differ
diff --git a/build/classes/java/main/UserCode/Conditions/ConditionChecker$1.class b/build/classes/java/main/UserCode/Conditions/ConditionChecker$1.class
index d20d5e4c61..7164b44225 100644
Binary files a/build/classes/java/main/UserCode/Conditions/ConditionChecker$1.class and b/build/classes/java/main/UserCode/Conditions/ConditionChecker$1.class differ
diff --git a/build/classes/java/main/UserCode/Conditions/ConditionChecker.class b/build/classes/java/main/UserCode/Conditions/ConditionChecker.class
index e0914b0ec9..cd2cbf87ed 100644
Binary files a/build/classes/java/main/UserCode/Conditions/ConditionChecker.class and b/build/classes/java/main/UserCode/Conditions/ConditionChecker.class differ
diff --git a/build/classes/java/main/UserCode/Conditions/ValueConditionType.class b/build/classes/java/main/UserCode/Conditions/ValueConditionType.class
index 78f38b6497..263ab4beca 100644
Binary files a/build/classes/java/main/UserCode/Conditions/ValueConditionType.class and b/build/classes/java/main/UserCode/Conditions/ValueConditionType.class differ
diff --git a/src/main/java/Farmio/Level.java b/src/main/java/Farmio/Level.java
index dbc1feb263..29d4898bd4 100644
--- a/src/main/java/Farmio/Level.java
+++ b/src/main/java/Farmio/Level.java
@@ -1,6 +1,7 @@
package Farmio;
import Places.Farm;
+import Places.WheatFarm;
import UserCode.Conditions.BooleanCondition;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
@@ -12,7 +13,6 @@
public class Level {
ArrayList narratives;
String filePath;
- int endMoney;
int endWheatSeed;
int endWheatGreen;
int endWheatRipe;
@@ -21,6 +21,8 @@ public class Level {
int endCow;
int endCowMilk;
int location;
+ int gold;
+ int deadline;
public Level(JSONObject object, Farmer farmer) {
JSONArray array = (JSONArray) object.get("narratives");
@@ -29,7 +31,7 @@ public Level(JSONObject object, Farmer farmer) {
narratives.add((String) i);
}
filePath = (String) object.get("file_path");
- endMoney = Math.toIntExact((Long) object.get("money"));
+ gold = Math.toIntExact((Long) object.get("money"));
endWheatSeed = Math.toIntExact((Long) object.get("wheat_seed"));
endWheatGreen = Math.toIntExact((Long) object.get("wheat_green"));
endWheatRipe = Math.toIntExact((Long) object.get("wheat_ripe"));
@@ -37,6 +39,9 @@ public Level(JSONObject object, Farmer farmer) {
endChickenEggs = 0;
endCow = 0;
endCowMilk = 0;
+ deadline = Math.toIntExact((Long) object.get("deadline"));
+
+
// location = Math.toIntExact((Long) object.get("location"));
}
@@ -55,17 +60,102 @@ public enum objectiveResult {
INVALID
}
+ public boolean checkDeadlineExceeded(int currentDay){
+ return deadline <= currentDay;
+ }
+
+ public boolean allDone(Farmer farmer){
+
+ //Wheat Farm
+ int WheatSeed = farmer.wheatFarm.getSeeds();
+ int WheatGreen = farmer.wheatFarm.getGreenWheat();
+ int WheatRipe = farmer.wheatFarm.getWheat();
+ return (WheatGreen == endWheatGreen) && (WheatRipe == endWheatRipe) && (endWheatSeed == WheatSeed);
+
+
+ //Cow Farm
+ }
+
public objectiveResult checkAnswer(Farmio farmio){
if (farmio.getFarmer().isHasfailedCurrentTask()) {
return objectiveResult.INVALID;
}
- //TODO if (...) to return NOT_DONE, DONE, FAILED
- return objectiveResult.DONE;
+
+ Farmer farmer = farmio.getFarmer();
+ int day = farmer.getDay();
+ objectiveResult currentLevelState;
+ if(checkDeadlineExceeded(day)){
+ currentLevelState = objectiveResult.FAILED;
+ getFeedback(farmer, currentLevelState);
+ }
+ else {
+ if (allDone(farmer)) {
+ currentLevelState = objectiveResult.DONE;
+ }
+ else{
+ currentLevelState = objectiveResult.NOT_DONE;
+ }
+ }
+ getFeedback(farmer, currentLevelState);
+ return currentLevelState;
+ }
+
+ public String checkIncompleteObjectives (Farmer farmer){
+ //compare the differences
+ //check the level types
+ String output = "";
+ int WheatSeed = farmer.wheatFarm.getSeeds();
+ int WheatGreen = farmer.wheatFarm.getGreenWheat();
+ int WheatRipe = farmer.wheatFarm.getWheat();
+
+ if(WheatSeed != endWheatSeed){
+ int balancedWheatSeed = endWheatSeed - WheatSeed;
+ output += "\nWheatSeed left :" + balancedWheatSeed;
+ }
+ else {
+ output += "\nWheatSeed Completed";
+ }
+ if(WheatGreen != endWheatGreen){
+ int balancedWheatGreen = endWheatGreen - WheatGreen;
+ output += "\n WheatGreen left :" + balancedWheatGreen;
+ }
+ else {
+ output += "\nWheatGreen Completed";
+ }
+ if(WheatRipe != endWheatRipe){
+ int balancedWheatRipe = endWheatRipe - WheatRipe;
+ output += "\nWheatRipe left :" + balancedWheatRipe;
+ }
+ else {
+ output += "\nWheatRipe Completed";
+ }
+
+ return output;
+ }
+
+
+ public String getFeedback( Farmer farmer, objectiveResult currentLevelState ){
+ //get Feedback on whats not completed
+ //need to complete.
+ if(currentLevelState == objectiveResult.DONE){
+ return "all tasks has been completed";
+ }
+
+ else if(currentLevelState == objectiveResult.NOT_DONE){
+ return checkIncompleteObjectives(farmer);
+ }
+
+ else if (currentLevelState == objectiveResult.FAILED){
+ return "level failed";
+ }
+ return "";
}
+
+
public Map getGoals() {
Map goals = new HashMap< String,Integer>();
- goals.put("Gold", endMoney);
+ goals.put("Gold", gold);
goals.put("Seeds", endWheatSeed);
goals.put("Wheat", endWheatGreen);
goals.put("Grain", endWheatRipe);
diff --git a/src/main/resources/levels/1.1.json b/src/main/resources/levels/1.1.json
index 453e089f1f..964b440f97 100644
--- a/src/main/resources/levels/1.1.json
+++ b/src/main/resources/levels/1.1.json
@@ -16,5 +16,6 @@
"wheat_seed": 0,
"wheat_green": 0,
"wheat_ripe": 0,
- "file_path": "Level1.1"
+ "file_path": "Level1.1",
+ "deadline" : 5;
}
\ No newline at end of file
diff --git a/src/main/resources/levels/1.2.json b/src/main/resources/levels/1.2.json
index 9cb29ec659..38b4c43330 100644
--- a/src/main/resources/levels/1.2.json
+++ b/src/main/resources/levels/1.2.json
@@ -9,5 +9,6 @@
"wheat_seed": 1,
"wheat_green": 0,
"wheat_ripe": 0,
- "file_path": "Level1.2"
+ "file_path": "Level1.2",
+ "deadline" : 5,
}
\ No newline at end of file
diff --git a/src/main/resources/levels/1.3.json b/src/main/resources/levels/1.3.json
index 4a26cd2b34..2f2ad85b67 100644
--- a/src/main/resources/levels/1.3.json
+++ b/src/main/resources/levels/1.3.json
@@ -8,5 +8,6 @@
"wheat_seed": 0,
"wheat_green": 1,
"wheat_ripe": 0,
- "file_path": "Level1.3"
+ "deadline" : 5,
+ "file_path": "Level1.3",
}
\ No newline at end of file
diff --git a/src/main/resources/levels/1.4.json b/src/main/resources/levels/1.4.json
index 951ca8c39a..68b4496280 100644
--- a/src/main/resources/levels/1.4.json
+++ b/src/main/resources/levels/1.4.json
@@ -12,5 +12,6 @@
"wheat_seed": 0,
"wheat_green": 0,
"wheat_ripe": 1,
+ "deadline" : 5,
"file_path": "Level1.4"
}
diff --git a/src/main/resources/levels/1.5.json b/src/main/resources/levels/1.5.json
index 400bc57f00..3014b5c824 100644
--- a/src/main/resources/levels/1.5.json
+++ b/src/main/resources/levels/1.5.json
@@ -7,5 +7,6 @@
"wheat_seed": 0,
"wheat_green": 0,
"wheat_ripe": 0,
+ "deadline" : 5,
"file_path": "Level1.5"
}
diff --git a/src/main/resources/levels/1.6.json b/src/main/resources/levels/1.6.json
index 947c4777df..00c9aa3726 100644
--- a/src/main/resources/levels/1.6.json
+++ b/src/main/resources/levels/1.6.json
@@ -9,5 +9,6 @@
"wheat_seed": 0,
"wheat_green": 0,
"wheat_ripe": 0,
+ "deadline" : 5,
"file_path": "Level1.6"
}
\ No newline at end of file