From f4d79b034f6216ba529d3d45a85c4aad6f746c7a Mon Sep 17 00:00:00 2001 From: ZMinghuiZ Date: Mon, 15 Apr 2024 22:18:16 +0800 Subject: [PATCH 1/4] Enhance PPP --- docs/UserGuide.md | 1 + docs/team/zminghuiz.md | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index ca46ff559b..fe069420a8 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -42,6 +42,7 @@ help students prepare for the future challenges. 5. Run the command `java -jar econoCraft.jar` to start the game. The chatbot should start and display the welcome message. 6. Follow the game instructions to start playing. 7. Your game progress will be auto saved in the `data` folder as `PlayerProfile.json`. +8. You will need to earn **$100000** to win the game. >[!Note] > * The game would prompt you to enter your action during the game. diff --git a/docs/team/zminghuiz.md b/docs/team/zminghuiz.md index ec2a6e86f2..70b773181c 100644 --- a/docs/team/zminghuiz.md +++ b/docs/team/zminghuiz.md @@ -2,8 +2,8 @@ ## Project: EconoCraft Pro -EconoCraft is a single player text adventure game where a player would start form from trying to achieve work-life balance to managing financial assets and a company. -This is a fun game that is full of uncertainty, which helps user to raise their financial awareness and management skills. +EconoCraft is a single player text adventure game where a player would start from trying to achieve work-life balance to managing financial assets and a company. +This is a fun game that is full of uncertainty and excitement, which helps user to raise their financial awareness and management skills. Given below are my contributions to the project: @@ -21,7 +21,7 @@ Given below are my contributions to the project: * **New Features**: Added status commands that allow players to check their status. * **New Features**: Added help command that allows players to check the available commands. - +
* **Code Quality Enhancement**: Abstracted main components of the project. [#30](https://github.com/AY2324S2-CS2113-T11-4/tp/pull/30) [#80](https://github.com/AY2324S2-CS2113-T11-4/tp/pull/80) * What it does: adds interfaces to manage the commands, miniGames, and random events. @@ -36,7 +36,6 @@ Given below are my contributions to the project: * **Code contributed**: [RepoSense link](https://nus-cs2113-ay2324s2.github.io/tp-dashboard/?search=zminghuiz&breakdown=true&sort=groupTitle%20dsc&sortWithin=title&since=2024-02-23&timeframe=commit&mergegroup=&groupSelect=groupByRepos&checkedFileTypes=docs~functional-code~test-code~other) -
* **Project management**: * Managed issues, milestones creation and allocation from release v1.0 to v2.1. @@ -55,7 +54,7 @@ Given below are my contributions to the project: * Updated documentation for `work`, `company management`, `status check`, `upgrade`, `help` and `random events` features. [#190](https://github.com/AY2324S2-CS2113-T11-4/tp/pull/190) * Developer Guide: * Added overall architecture and components interaction explanation with diagram. [#65](https://github.com/AY2324S2-CS2113-T11-4/tp/pull/65) - * Updated implementation details for the `work`, `company management`, and `random events` features. [#65](https://github.com/AY2324S2-CS2113-T11-4/tp/pull/65) + * Updated implementation details for the `work`, `company management`, and `random events` features. [#65](https://github.com/AY2324S2-CS2113-T11-4/tp/pull/65) [#197](https://github.com/AY2324S2-CS2113-T11-4/tp/pull/197) * Added flowchart to explain the game logic. [#84](https://github.com/AY2324S2-CS2113-T11-4/tp/pull/84) From b7b603dcd4ce06195e65535645ae69797d3535c0 Mon Sep 17 00:00:00 2001 From: ZMinghuiZ Date: Mon, 15 Apr 2024 22:52:40 +0800 Subject: [PATCH 2/4] Adjust documentation --- docs/DeveloperGuide.md | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 66fcfbb001..8b6d7e095d 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -27,7 +27,8 @@ ## Acknowledgements -{list here sources of all reused/adapted ideas, code, documentation, and third-party libraries -- include links to the original source as well} +* [org.json](https://github.com/stleary/JSON-java) - Handles read and write JSON files. +* [mockito](https://site.mockito.org/) - Mocking framework for unit tests. ## Design @@ -63,12 +64,15 @@ The functionality of the game is divided into different components, each respons The components interact with each other in the following way when a user enters a `stock` command to but stocks: ![Interaction.png](UML%20diagram%2FInteraction.png) -Under `Logic` and `SubLogic` component there are: +> [!NOTE] +> - The lifeline for SubLogic should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline continues till the end of diagram. + +Under `Logic` and `SubLogic` components are: -`CommandFactory`, `Minigame` and `RandomEvent` components: +`CommandFactory`, `Minigame` and `RandomEvent` components. * Each defines its API for creating commands and mini-games respectively, where - `Command` is the API for `CommandFactory` and `MiniGame` is the API for `MiniGame`. -* Implements its functionality with concrete classes such as `WorkCommand` and `TypingGame`. + `Command` is the API for `CommandFactory`, `MiniGame` is the API for `MiniGame` and `RandomEvent` is the API for `RandomEvent`. +* Implements its functionality with concrete classes such as `WorkCommand`, `TypingGame` or `PositiveEvent`. The sections below would give more details of each component. @@ -128,16 +132,7 @@ The mechanism: 3. `Asset` class executes the `sellStock()` function and sell all of the stocks the player currently possess. 4. Information related to stocks will be updated inside `Asset` and `PlayerProfile` class. ->[!NOTE] -> * Corrupted data file will be handled by `Loader` class and return a new `PlayerProfile` class to replace the corrupted data. -> ``` -> { ->"name": "jj", ->"occupation": "Artificial intelligence", ->"health": -1, ->"currentRound": 1, -> ``` -> In the above example, the health value is -1 which is not a valid value. The `Loader` class will restart the game. + ## MiniGame components @@ -256,6 +251,18 @@ The above is the load process called by gameLogic. data structures. 4. `Loader` returns the `PlayerProfile` class to load the previous information. +>[!NOTE] +> * Corrupted data file will be handled by `Loader` class and return a new `PlayerProfile` class to replace the corrupted data. +> ``` +> { +>"name": "jj", +>"occupation": "Artificial intelligence", +>"health": -1, +>"currentRound": 1, +> ``` +> In the above example, the health value is -1 which is not a valid value. The `Loader` class will restart the game. + + ## Product scope ### Target user playerProfile From abab326ffe1410df2b5028a8d2c3ed2569709f14 Mon Sep 17 00:00:00 2001 From: ZMinghuiZ Date: Mon, 15 Apr 2024 22:54:14 +0800 Subject: [PATCH 3/4] Resolve output error --- .../java/minigame/cryptocurrency/CryptoCurrencyStorage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/minigame/cryptocurrency/CryptoCurrencyStorage.java b/src/main/java/minigame/cryptocurrency/CryptoCurrencyStorage.java index ec935cdb1d..f43b23ef44 100644 --- a/src/main/java/minigame/cryptocurrency/CryptoCurrencyStorage.java +++ b/src/main/java/minigame/cryptocurrency/CryptoCurrencyStorage.java @@ -64,7 +64,7 @@ public void play() { System.out.println("How much in USD do you want to invest in " + current.returnCryptoName() + "? Input 0 if you want none"); - System.out.println("Please input a value larger than the crypto price because you are no longer" + + System.out.println("Please input a value larger than the crypto price because you are no longer\n" + " inputting quantities, you are just inputting the amount of money you want to invest in"); int response = Integer.parseInt(scanner.nextLine()); if (response == 0) { From 701dedb32a88fd13319971ec8ac6bb5c44d1e1de Mon Sep 17 00:00:00 2001 From: ZMinghuiZ Date: Mon, 15 Apr 2024 23:04:35 +0800 Subject: [PATCH 4/4] Add more details for DG --- docs/DeveloperGuide.md | 7 +++++-- docs/UserGuide.md | 40 ++++++++++++++++++++++------------------ 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 8b6d7e095d..afc94b4749 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -133,8 +133,6 @@ The mechanism: 4. Information related to stocks will be updated inside `Asset` and `PlayerProfile` class. - - ## MiniGame components Here is the partial class diagram of the `MiniGame` component: @@ -146,6 +144,7 @@ The `MiniGame` mechanism: 2. When these commands are generated and executed in `EconoCraftLogic`, the respective mini-game would be played. 3. The command would then update the player profile according to the mini-game result. + # Implementation ## MiniGame - Typing Game @@ -234,6 +233,10 @@ user based on the stock's current price. 5. Based on the decision made and the event type, the player would receive different rewards or punishments. 6. The event would add uncertainty and excitement to the game. +> [!NOTE] +> - Random event triggered is based on probability of each event type defined in `EventGenerator` class. +> - However, the probability of each event type can be adjusted based on the player's status. E.g. if the player's health is low, the probability of getting sick will be higher. + ## File Management ![Save.png](UML%20diagram%2FSave.png) The above is the save process called by gameLogic. diff --git a/docs/UserGuide.md b/docs/UserGuide.md index dba42ce8c3..dd1225e713 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -4,6 +4,7 @@ ## Table of Contents - [Introduction](#introduction) - [Quick Start](#quick-start) +- [Command Summary](#command-summary) - [Features](#features) - [Work](#feature---work) - [Exercise](#feature---exercise) @@ -25,6 +26,7 @@ - [Random Events](#feature---random-events) - [Company Status](#company-status) - [Random Events](#feature---random-events) +- [FAQ](#faq) ## Introduction @@ -49,6 +51,26 @@ help students prepare for the future challenges. > * If you are stuck, you can use the `help` command to see a list of commands that you can use. > * For advanced user, only normal modification is allowed. Extreme data modification may result in game progress reset. +## Command Summary + +| Description | Command | +|------------------------|--------------------------------------| +| Work | `work` | +| Exercise | `exercise` | +| Rest | `rest` | +| Check Player Status | `status` | +| Check Company Status | `company` | +| Help | `help` | +| Sell Stock | `sellstock` | +| Buy Stock | `stock` | +| Buy Bond | `bond` | +| Buy Crypto | `crypto` | +| Upgrade | `upgrade` | +| Hire Employee | `hire ` | +| Fire Employee | `fire ` | +| Adjust Employee Salary | `raise ` or `lower ` | +| Exit | `bye` | + ## Features ### Feature - Work @@ -737,21 +759,3 @@ If you are stuck, you can use the `help` command to see a list of commands that by loader class during initialization, if the folder is empty, the program will open a new record. To transfer the record, you can copy your current json file into `data` folder at your new computer. -## Command Summary - -| Description | Command | -|------------------------|--------------------------------------| -| Work | `work` | -| Exercise | `exercise` | -| Rest | `rest` | -| Check Status | `status` | -| Help | `help` | -| Sell Stock | `sellstock` | -| Buy Stock | `stock` | -| Upgrade | `upgrade` | -| Hire Employee | `hire ` | -| Fire Employee | `fire ` | -| Adjust Employee Salary | `raise ` or `lower ` | -| Exit | `bye` | - -