Skip to content

Commit

Permalink
Merge pull request #203 from ZMinghuiZ/Documentation-WrapUp
Browse files Browse the repository at this point in the history
Documentation wrap up
  • Loading branch information
ZMinghuiZ authored Apr 15, 2024
2 parents 4d0f367 + 701dedb commit 61b2b86
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 40 deletions.
42 changes: 26 additions & 16 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -128,17 +132,6 @@ 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

Expand All @@ -151,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
Expand Down Expand Up @@ -239,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.
Expand All @@ -256,6 +254,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
Expand Down
41 changes: 23 additions & 18 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -25,6 +26,7 @@
- [Random Events](#feature---random-events)
- [Company Status](#company-status)
- [Random Events](#feature---random-events)
- [FAQ](#faq)

## Introduction

Expand All @@ -42,12 +44,33 @@ 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.
> * 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 <employee number>` |
| Fire Employee | `fire <employee number>` |
| Adjust Employee Salary | `raise <amount>` or `lower <amount>` |
| Exit | `bye` |

## Features

### Feature - Work
Expand Down Expand Up @@ -736,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 <employee number>` |
| Fire Employee | `fire <employee number>` |
| Adjust Employee Salary | `raise <amount>` or `lower <amount>` |
| Exit | `bye` |


9 changes: 4 additions & 5 deletions docs/team/zminghuiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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.

<div style="page-break-after: always;"></div>

* **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.
Expand All @@ -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)

<div style="page-break-after: always;"></div>

* **Project management**:
* Managed issues, milestones creation and allocation from release v1.0 to v2.1.
Expand All @@ -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)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 61b2b86

Please sign in to comment.