Skip to content

Commit

Permalink
Refactored Farmio
Browse files Browse the repository at this point in the history
  • Loading branch information
jing-xuan committed Nov 7, 2019
1 parent d5c1ebc commit 998fe4f
Show file tree
Hide file tree
Showing 83 changed files with 299 additions and 314 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


## Features
commands.Command Format:
logic.commands.Command Format:
- text
### Feature 1.1. Resume previous version of choice: `load`

Expand Down
10 changes: 5 additions & 5 deletions docs/team/JingXuan.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ AddressBook - Level 3 is a desktop address book application used for teaching So

== Summary of contributions

* *Major enhancement*: added *the ability to undo/redo previous commands*
** What it does: allows the user to undo all previous commands one at a time. Preceding undo commands can be reversed by using the redo command.
** Justification: This feature improves the product significantly because a user can make mistakes in commands and the app should provide a convenient way to rectify them.
** Highlights: This enhancement affects existing commands and commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing commands.
* *Major enhancement*: added *the ability to undo/redo previous logic.commands*
** What it does: allows the user to undo all previous logic.commands one at a time. Preceding undo logic.commands can be reversed by using the redo command.
** Justification: This feature improves the product significantly because a user can make mistakes in logic.commands and the app should provide a convenient way to rectify them.
** Highlights: This enhancement affects existing logic.commands and logic.commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing logic.commands.
** Credits: _{mention here if you reused any code/ideas from elsewhere or if a third-party library is heavily used in the feature so that a reader can make a more accurate judgement of how much effort went into the feature}_

* *Minor enhancement*: added a history command that allows the user to navigate to previous commands using up/down keys.
* *Minor enhancement*: added a history command that allows the user to navigate to previous logic.commands using up/down keys.

* *Code contributed*: [https://github.com[Functional code]] [https://github.com[Test code]] _{give links to collated code files}_

Expand Down
10 changes: 5 additions & 5 deletions docs/team/John.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ With interactive gameplay and gamification, we hope that FarmLogic will be able

== Summary of contributions

* *Major enhancement*: added *the ability to undo/redo previous commands*
** What it does: allows the user to undo all previous commands one at a time. Preceding undo commands can be reversed by using the redo command.
** Justification: This feature improves the product significantly because a user can make mistakes in commands and the app should provide a convenient way to rectify them.
** Highlights: This enhancement affects existing commands and commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing commands.
* *Major enhancement*: added *the ability to undo/redo previous logic.commands*
** What it does: allows the user to undo all previous logic.commands one at a time. Preceding undo logic.commands can be reversed by using the redo command.
** Justification: This feature improves the product significantly because a user can make mistakes in logic.commands and the app should provide a convenient way to rectify them.
** Highlights: This enhancement affects existing logic.commands and logic.commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing logic.commands.
** Credits: _{mention here if you reused any code/ideas from elsewhere or if a third-party library is heavily used in the feature so that a reader can make a more accurate judgement of how much effort went into the feature}_

* *Minor enhancement*: added a history command that allows the user to navigate to previous commands using up/down keys.
* *Minor enhancement*: added a history command that allows the user to navigate to previous logic.commands using up/down keys.

* *Code contributed*: [https://github.com[Functional code]] [https://github.com[Test code]] _{give links to collated code files}_

Expand Down
10 changes: 5 additions & 5 deletions docs/team/jinghui.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ FarmLogic is a game that is targeted to children aged between 11 and 14, and aim

== Summary of contributions

* *Major enhancement*: added *the ability to undo/redo previous commands*
** What it does: allows the user to undo all previous commands one at a time. Preceding undo commands can be reversed by using the redo command.
** Justification: This feature improves the product significantly because a user can make mistakes in commands and the app should provide a convenient way to rectify them.
** Highlights: This enhancement affects existing commands and commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing commands.
* *Major enhancement*: added *the ability to undo/redo previous logic.commands*
** What it does: allows the user to undo all previous logic.commands one at a time. Preceding undo logic.commands can be reversed by using the redo command.
** Justification: This feature improves the product significantly because a user can make mistakes in logic.commands and the app should provide a convenient way to rectify them.
** Highlights: This enhancement affects existing logic.commands and logic.commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing logic.commands.
** Credits: _{mention here if you reused any code/ideas from elsewhere or if a third-party library is heavily used in the feature so that a reader can make a more accurate judgement of how much effort went into the feature}_

* *Minor enhancement*: added a history command that allows the user to navigate to previous commands using up/down keys.
* *Minor enhancement*: added a history command that allows the user to navigate to previous logic.commands using up/down keys.

* *Code contributed*: [https://github.com[Functional code]] [https://github.com[Test code]] _{give links to collated code files}_

Expand Down
10 changes: 5 additions & 5 deletions docs/team/umar.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ FarmLogic

== Summary of contributions

* *Major enhancement*: added *the ability to undo/redo previous commands*
** What it does: allows the user to undo all previous commands one at a time. Preceding undo commands can be reversed by using the redo command.
** Justification: This feature improves the product significantly because a user can make mistakes in commands and the app should provide a convenient way to rectify them.
** Highlights: This enhancement affects existing commands and commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing commands.
* *Major enhancement*: added *the ability to undo/redo previous logic.commands*
** What it does: allows the user to undo all previous logic.commands one at a time. Preceding undo logic.commands can be reversed by using the redo command.
** Justification: This feature improves the product significantly because a user can make mistakes in logic.commands and the app should provide a convenient way to rectify them.
** Highlights: This enhancement affects existing logic.commands and logic.commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing logic.commands.
** Credits: _{mention here if you reused any code/ideas from elsewhere or if a third-party library is heavily used in the feature so that a reader can make a more accurate judgement of how much effort went into the feature}_

* *Minor enhancement*: added a history command that allows the user to navigate to previous commands using up/down keys.
* *Minor enhancement*: added a history command that allows the user to navigate to previous logic.commands using up/down keys.

* *Code contributed*: [https://github.com[Functional code]] [https://github.com[Test code]] _{give links to collated code files}_

Expand Down
10 changes: 5 additions & 5 deletions docs/team/zhengwen.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ AddressBook - Level 3 is a desktop address book application used for teaching So

== Summary of contributions

* *Major enhancement*: added *the ability to undo/redo previous commands*
** What it does: allows the user to undo all previous commands one at a time. Preceding undo commands can be reversed by using the redo command.
** Justification: This feature improves the product significantly because a user can make mistakes in commands and the app should provide a convenient way to rectify them.
** Highlights: This enhancement affects existing commands and commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing commands.
* *Major enhancement*: added *the ability to undo/redo previous logic.commands*
** What it does: allows the user to undo all previous logic.commands one at a time. Preceding undo logic.commands can be reversed by using the redo command.
** Justification: This feature improves the product significantly because a user can make mistakes in logic.commands and the app should provide a convenient way to rectify them.
** Highlights: This enhancement affects existing logic.commands and logic.commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing logic.commands.
** Credits: _{mention here if you reused any code/ideas from elsewhere or if a third-party library is heavily used in the feature so that a reader can make a more accurate judgement of how much effort went into the feature}_

* *Minor enhancement*: added a history command that allows the user to navigate to previous commands using up/down keys.
* *Minor enhancement*: added a history command that allows the user to navigate to previous logic.commands using up/down keys.

* *Code contributed*: [https://github.com[Functional code]] [https://github.com[Test code]] _{give links to collated code files}_

Expand Down
2 changes: 1 addition & 1 deletion farmio.log.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Nov 06, 2019 1:34:09 PM farmio.Farmio run
INFO: New game session started.
Nov 06, 2019 1:34:19 PM farmio.Parser parse
Nov 06, 2019 1:34:19 PM logic.Parser parse
INFO: Deteched invalid command at stage: MENU_START command:
13 changes: 9 additions & 4 deletions src/main/java/farmio/Farmio.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
package farmio;

import commands.Command;
import commands.CommandWelcome;
import exceptions.FarmioException;
import exceptions.FarmioFatalException;
import gameassets.Farmer;
import gameassets.Level;
import logic.commands.Command;
import logic.commands.CommandWelcome;
import farmio.exceptions.FarmioException;
import farmio.exceptions.FarmioFatalException;
import frontend.AsciiColours;
import frontend.Simulation;
import frontend.Ui;
import frontend.UiManager;
import logic.Logic;
import storage.Storage;
import storage.StorageManager;

import java.io.IOException;
import java.util.EnumSet;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package exceptions;
package farmio.exceptions;

public class FarmioException extends Exception {
public FarmioException(String error) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package exceptions;
package farmio.exceptions;

public class FarmioFatalException extends Exception {
public FarmioFatalException(String message) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frontend/GameConsole.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package frontend;

import farmio.Farmer;
import gameassets.Farmer;

import java.util.Map;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package farmio;
package frontend;

import exceptions.FarmioFatalException;
import frontend.Simulation;
import frontend.Ui;
import farmio.exceptions.FarmioFatalException;

public class Menu {

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/frontend/Simulation.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package frontend;

import exceptions.FarmioFatalException;
import farmio.exceptions.FarmioFatalException;
import farmio.Farmio;
import farmio.Farmer;
import farmio.Level;
import farmio.Storage;
import gameassets.Farmer;
import gameassets.Level;
import storage.Storage;

public class Simulation {
private static final int SLEEP_TIME = 300;
Expand Down Expand Up @@ -131,7 +131,7 @@ public void showNarrative() throws FarmioFatalException {
simulate();
ui.showWarning("Invalid Command for story mode!");
ui.show("Story segment only accepts [skip] to skip the story or pressing [ENTER] to continue with the "
+ "narrative.\nIf you wish to use other commands, enter [skip] followed by entering the "
+ "narrative.\nIf you wish to use other logic.commands, enter [skip] followed by entering the "
+ "command of your choice.");
userInput = ui.getInput();
}
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/frontend/Ui.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package frontend;

import exceptions.FarmioFatalException;
import farmio.Level;

import java.util.Scanner;

public interface Ui {
/**
* Removes the clear screen string if the OS is windows.
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/frontend/UiDummy.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package frontend;

import exceptions.FarmioFatalException;
import farmio.Level;

public class UiDummy implements Ui {
public static String uiTestString;
public static String input;
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/frontend/UiManager.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package frontend;

import exceptions.FarmioFatalException;
import farmio.Level;

import java.util.Scanner;

public class UiManager implements Ui {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package farmio;
package gameassets;

import exceptions.FarmioException;
import exceptions.FarmioFatalException;
import farmio.exceptions.FarmioException;
import farmio.exceptions.FarmioFatalException;
import farmio.Farmio;
import frontend.GameConsole;
import places.ChickenFarm;
import places.CowFarm;
import places.WheatFarm;
import usercode.tasks.TaskList;
import gameassets.places.ChickenFarm;
import gameassets.places.CowFarm;
import gameassets.places.WheatFarm;
import logic.usercode.tasks.TaskList;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package farmio;
package gameassets;

import farmio.Farmio;
import gameassets.Farmer;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package places;
package gameassets.places;

import exceptions.FarmioException;
import farmio.exceptions.FarmioException;
import org.json.simple.JSONObject;

public class ChickenFarm extends Farm {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package places;
package gameassets.places;

import exceptions.FarmioException;
import farmio.exceptions.FarmioException;
import org.json.simple.JSONObject;

public class CowFarm extends Farm {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package places;
package gameassets.places;

import org.json.simple.JSONObject;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package places;
package gameassets.places;

public class Market {
public static final int PRICE_OF_SEED = 10;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package places;
package gameassets.places;

import exceptions.FarmioException;
import farmio.exceptions.FarmioException;
import org.json.simple.JSONObject;

public class WheatFarm extends Farm {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package farmio;
package logic;

import frontend.Simulation;
import frontend.Ui;
import frontend.UiManager;
import exceptions.FarmioException;
import exceptions.FarmioFatalException;
import farmio.Farmio;
import farmio.exceptions.FarmioException;
import farmio.exceptions.FarmioFatalException;

public class Logic {

Expand Down
Loading

0 comments on commit 998fe4f

Please sign in to comment.