-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CS2113-T14-1] TheGreatDetective #41
base: master
Are you sure you want to change the base?
Changes from 250 commits
d0f10a6
10f8a0d
6971bd7
31b84b4
96fba55
4f3cc38
0028d96
b05cc6b
8bc6024
a3c4eca
a320a2a
75f1489
c512ba2
39000a8
09916f5
2a91932
73b9c17
6e069a3
08bbea6
9166a31
70050c5
2eb8e6d
731211a
ccf3d52
e7528df
2dffce9
aa2f8f2
d068d49
8cc9794
50382b0
3506348
951f6a1
ca703fb
965979d
c1b04e7
8b2c440
12d8e4d
e9ab3fc
e6b15da
db941de
0cc6dd8
4e14bee
5a9d17b
77e4db5
b833f9b
56c6f49
03c5da1
40cd557
1380222
f02518d
13a5697
940d874
9ef7025
0b2cf3b
06956b0
61f22cd
f8a01fc
ccf0e20
2b6be1e
f29b6ea
67a791d
6b70656
139a82d
c644523
ffa5ad8
75864c4
bcca69e
28843ca
368cb0e
eb5886a
9a945b9
7708ead
e494afa
ddb1d01
9a11a18
43c4bde
9a5376a
08ae9fe
41f3eec
28b8f4c
4bf64ef
b10e82f
35232e6
adce1a7
0592023
52a0818
3b0e4dd
8f84cb5
3f26f51
07fe4df
b3e65fb
7a30eb7
399557c
373e6f8
101a6d8
49f97aa
f3265a5
ba54967
4a321c5
fc6d712
a7d5b68
80f664a
1a6595a
7acf993
56f22a2
c06885b
1bcb813
d16b873
e306da3
1d475ba
053a6a0
07d0525
a4306c6
d07d493
9ce48cd
9a35538
15f2de4
4987676
ddee507
48f8298
4d4e9e2
050b238
29b1c4c
af2cd37
447efe8
c4d0d96
696f8c2
040f6f1
b08c0c7
f7cb9a1
4a28390
2b3cd17
d02ded8
00c0e5d
d7d74a8
2cb2654
5444d1a
da8a3fa
f302685
b7e0565
80a28ca
84804f2
f6c8fc8
1a41b9f
ca0e919
502f019
5faa92b
5f6baca
224a54e
6baf22f
f849e78
eaec8d0
49b97a7
1bee64e
12203a1
3d97e87
b96a70e
296bb96
e5013ea
8b28938
7a55cad
6190882
1ae672b
1d237af
36c5b07
d21e255
eac5fc7
6a1ca00
928d7ba
aceb60d
5629278
77d6c04
952af61
c9a65df
b5c0d03
17741b4
f52d8c9
326ef9e
448730c
7ba09dd
e522049
9a2093f
5660a15
76d6e15
c98f696
f4b9508
d77e97e
c9ef1e8
b420f75
87cacac
a32350d
51bf18f
de381bb
a1fdf34
2710231
8feac6a
eb3d836
114712c
c038469
26ca842
cdd2d5c
23f5889
4e7d620
fd01744
9cac85e
06eaca0
7e074b3
2095aed
fc0cee2
0093ea2
2111c56
f37abdb
af0541e
9022fb1
005965e
84480a2
1270419
a0de22d
0a95893
12c9f52
c0a41ef
4f676ff
228029d
61e4902
9f7d2e3
16e2ef8
491dafd
b5fa4f5
fb08535
d154d22
331a1a5
39ded29
656aaee
338cf53
81d0f06
2a1047b
6eaddec
6867974
cb7a9af
70fed81
739b38d
4327fb1
8bef885
b03e501
2b0e759
feba1ec
f521bdf
aa9c3ce
c0296d1
3823311
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,4 +43,5 @@ checkstyle { | |
|
||
run{ | ||
standardInput = System.in | ||
enableAssertions = true | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
@startuml | ||
|
||
allowmixing | ||
skinparam componentStyle rectangle | ||
|
||
class Duke | ||
|
||
|
||
component Ui { | ||
} | ||
component Storage { | ||
} | ||
component Investigation { | ||
} | ||
component SceneList { | ||
} | ||
component Parser { | ||
} | ||
|
||
component Command { | ||
abstract class Command | ||
Class XYZCommand | ||
} | ||
|
||
|
||
Duke --> Parser | ||
Duke ..> Command: execute > | ||
Parser ..> XYZCommand: create > | ||
Command <|-- XYZCommand | ||
Command ..> Storage | ||
Command ..> Ui | ||
|
||
Investigation <.left. Command | ||
|
||
SceneList <.. Command | ||
note bottom of XYZCommand: XYZCommand = ViewCommand, NextCommand, etc | ||
|
||
hide members | ||
|
||
@enduml |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,37 +2,294 @@ | |
|
||
## Acknowledgements | ||
|
||
{list here sources of all reused/adapted ideas, code, documentation, and third-party libraries -- include links to the original source as well} | ||
The plot of the game was adopted from one of the games available in the Mini Program in WeChat called Ju Ben Sha. The original story was in Chinese and was translated to English with the help of Google Translate. | ||
|
||
## Design & implementation | ||
## Content Page | ||
* [Architecture](#Architecture) | ||
* [Main Components of the Architecture](#Main-components-of-the-architecture) | ||
* [Parser Component](#Parser-component) | ||
* [Note Component](#Note-component) | ||
* [UI Component](#UI-component) | ||
* [Command Component](#Command-component) | ||
* [Investigation Component](#Investigation-component) | ||
* [Scene Component](#Scene-component) | ||
* [Storage Component](#Storage-component) | ||
* [Suspect Component](#Suspect-component) | ||
* [Implementation](#Implementation) | ||
|
||
{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel that there could be a section here to cover the target user and the value proposition of the product, as well as maybe a brief overview of what it does. |
||
## Design | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May want to increase the font size of your sequence diagrams as it is abit difficult to read. |
||
|
||
### Architecture | ||
![High Level Architectural design](./main_architecture.png) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps you can also add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this diagram needed here? As it is repeated again below at line 53. |
||
|
||
## Product scope | ||
### Target user profile | ||
![High Level Architecture Diagram](./high_level_architecture.png) | ||
|
||
{Describe the target user profile} | ||
The _**Architecture Diagram**_ given above explains the high-level design of the App. | ||
|
||
### Value proposition | ||
Given below is a quick overview of main components and how they interact with each other. | ||
|
||
{Describe the value proposition: what problem does it solve?} | ||
###Main components of the architecture | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may want to add a space after your There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
`Duke` is responsible for, | ||
|
||
* At app launch: Initializes the components in the correct sequence, and connects them up with each other. | ||
* During the game: Takes in user input and coordinates other components to parse and execute the input in a while loop, until the game is shut down. | ||
|
||
The rest of the App consists of eight components. | ||
|
||
`Parser`: | ||
`Ui`: | ||
`Command`: The command executor. | ||
`Investigation`: | ||
`Scene`: | ||
`Suspect`: | ||
`Note`: | ||
`Storage`: | ||
|
||
**How the architecture components interact with each other** | ||
|
||
The Sequence Diagram below shows how the components interact with each other for the scenario where the user issues the command `/next`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
![High Level Sequence Diagram for main architecture](./main_architecture.png) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this image supposed to be here or in line 23? Because I notice that it is the same exact image main_architecture.png. |
||
|
||
### Parser component | ||
**API:** Parser.java | ||
|
||
The parser component is used to parse the input given by the user. | ||
|
||
The Sequence Diagram below illustrates the interactions within the | ||
`Parser` component for the `getCommandFromUser("/next")` API call. | ||
|
||
![Parser design](./ParserUML.png) | ||
The class diagram below shows how the parser interacts with the other classes | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
|
||
![Parser class diagram design](./ParserClassDiagram.png) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
How the parser work | ||
- When the user gives an input, the parser will the appropriate command for this input. | ||
- In the case of `/next` as the input, the NextCommand will be generated. | ||
- The NextCommand is inherits from the abstract class Command. | ||
- If the input does not generate a valid command type, it throws the invalidInputException. | ||
- The abstract Command class requires SceneList, Ui and Investigate component as its dependencies. | ||
|
||
|
||
### Note component | ||
**API:** Note.java | ||
|
||
The note component allows user to create / open / delete /search note. | ||
|
||
How the note work | ||
- When user want to take note, a note with title and content will be created and added | ||
to note list. | ||
- Notes in the note list can be found by their titles and scene index. | ||
- Unwanted notes can be deleted. | ||
|
||
### UI component | ||
**API:** `Ui.java` | ||
|
||
The ui component communicates with the user via the terminal. Other component call methods of | ||
ui to print output to terminal. | ||
|
||
How the ui work | ||
- Print messages to terminal depending on the scene. | ||
- Print corresponding output to terminal according to input command. | ||
|
||
[UML diagram for Ui](./UiUML.png) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The link to the UML diagram is broken. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
### Command component | ||
**API:** `Command.java` | ||
|
||
Here’s a (partial) class diagram of the `Command` component: | ||
|
||
|
||
![(partial class) diagram of Command component](./Command_Class_Diagram.png) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
|
||
How the `Command` componnet works: | ||
1. The user input is first parsed using the `Parse` component | ||
2. This results in a `Command` object (more precisely, an object of one of its subclasses e.g., NextCommand), which is executed by `Duke`. | ||
3. The command can communicate with the `Ui`, `Investigation` and `SceneList` when it is executed (e.g. to go to the next scene). | ||
4. Some of the commands may update the `Storage`. | ||
|
||
|
||
The Sequence Diagram [below](./next_command_sequence_diagram.png) illustrates within the `Command` component for the `execute(ui,investigation,sceneList)` method call of the `NextCommand` class. | ||
|
||
|
||
![Sequence diagram for execute(ui,investigation,sceneList) method call of NextCommand](./next_command_sequence_diagram.png) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with @titustortoiseturtle1999, but nice job on colouring the different sections to allow us to differentiate the different sections. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think activations bars are optional, but as some of your other diagrams included it, you may want to standardize it. |
||
|
||
### Investigation component | ||
**API:** `Investigation.java` | ||
|
||
|
||
![Investigation Sequence Diagram](./Investigation_Sequence_Diagram.png) | ||
|
||
The investigation class manages the investigation in each investigation scene. | ||
|
||
|
||
How the `Investigation` component works: | ||
- When an investigation command is returned from the parser, we investigate the input given by the user. | ||
- Investigation are divided into two parts, suspect stage and clue stage | ||
- `Suspect Stage`: Prints the list of suspects and prompts user for input, user selects which suspect he/she wants | ||
to investigate. Proceeds to clue stage when input entered are valid | ||
- `Clue Stage`: Prints the list of clues available for viewing for the selected suspect previously and prompts user | ||
for input, user selects which clue he/she wants to view. The user may enter the number '0' to return to the | ||
`Suspect Stage`. Otherwise, after selecting the clue, the clue is then marked as checked and contents of the selected | ||
clue is displayed on the terminal. | ||
- The Investigation class is also used to determine if the user has managed to find the correct killer | ||
at the end of the game. | ||
|
||
### Scene component | ||
**API:** `Scene.java` | ||
|
||
The scene class contains and produces the narrative for the scene. | ||
It also holds a suspectList, which contains the suspects and their respective clues. | ||
|
||
How the scene class work | ||
- Each scene has a scene type. | ||
- For each scene type, we interact differently from the user. | ||
|
||
See below for example. | ||
- The introduction scene shows the introductory message to the user. | ||
- The investigation scene asks the user either investigate a suspect or look into a clue. | ||
![](Scene.png) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
|
||
|
||
### Storage component | ||
**API:** `Storage.java` | ||
The local Game Data Storage feature allows users to save the current game progress and resume the saved progress in the Future. | ||
It is facilitated by ```java.io.File``` and ```java.io.FileWriter```. | ||
It implements the following operations | ||
- ```Storage#checkPath()``` -- Checks if there is a valid path to the data file, and creates a new data file if the data file is missing or hte path is invalid. | ||
- ```Storage#readFile()``` -- Reads all the lines in the data files and store the information into a ```ArrayList<String>``` type Array List, then close the file. | ||
- ```Storage#rewriteFile()``` -- Erase the content of the data file and rewrite from the start, then save and close the file. | ||
|
||
At first ```Storage file = new Storage("name.txt")```, initialise the ```Storage``` class type with the name of the file. | ||
Then ```file.checkPath()``` will check for existing data file and creates a new data file if the path ```./Data/name.txt```is invalid. | ||
Then read the file and store the information into array list using ```ArrayList<String> content = file.readFile()```. | ||
Eventually, edit the content and rewrite to data file using ```file.rewriteFile(content)``` | ||
### Suspect component | ||
**API:** Suspect.java | ||
|
||
The `Suspect` class contains an `ArrayList` of the class `Clue`. | ||
|
||
How the suspect class work: | ||
|
||
* Different suspects in a particular scene are stored in the `SuspectList` class. | ||
* Suspects are stored via a `LinkedHashMap<String, Suspect>`, with the string being the suspect's name. | ||
|
||
See below for example: | ||
|
||
* The first investigation scene has a `SuspectList` containing one name, "Father", | ||
and four clues within its corresponding `Suspect` class. | ||
|
||
![](Suspect.png) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with @RemusTeo. A constructor box should be added here as well. |
||
|
||
## Implementation | ||
|
||
This section describes some noteworthy details on how certain features are implemented. | ||
|
||
### Display checked-clues feature | ||
|
||
This feature allows the user to review the clues that have been gathered. The clues will be displayed according to the suspect they belong to. | ||
To implement this feature, a clue tracker that contains all 5 suspects and all the clues corresponding to each suspect is used. | ||
Whenever a clue is checked out by the user, the respective clue in the clue tracker will be marked as checked. | ||
When the view feature is invoked, clues in the clue tracker will be iterated through. Once a checked-clue is found, it will be printed out for user tp review. | ||
|
||
An alternative to this would be to update the clue status under each scene. However, this does not allow the display of clues according to different suspects. | ||
|
||
### Local Game Data Storage | ||
|
||
The local Game Data Storage feature allows users to save the current game progress and resume the saved progress in the Future. | ||
It is facilitated by ```java.io.File``` and ```java.io.FileWriter```. | ||
It implements the following operations | ||
- ```Storage#checkPath()``` -- Checks if there is a valid path to the data file, and creates a new data file if the data file is missing or hte path is invalid. | ||
- ```Storage#readFile()``` -- Reads all the lines in the data files and store the information into a ```ArrayList<String>``` type Array List, then close the file. | ||
- ```Storage#rewriteFile()``` -- Erase the content of the data file and rewrite from the start, then save and close the file. | ||
|
||
At first ```Storage file = new Storage("name.txt")```, initialise the ```Storage``` class type with the name of the file. | ||
Then ```file.checkPath()``` will check for existing data file and creates a new data file if the path ```./Data/name.txt```is invalid. | ||
Then read the file and store the information into array list using ```ArrayList<String> content = file.readFile()```. | ||
Eventually, edit the content and rewrite to data file using ```file.rewriteFile(content)``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps a diagram can be included here to allow visualisation of how the storage component works. |
||
|
||
###Taking Notes For Specified Scene | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This paragraph feels a little wordy, and the length makes it disinteresting to the reader. You could consider reformatting it into something more digestible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
This note-taking feature allows users to take note whenever they want, and store these notes locally. All the locally saved notes will be loaded and accessible | ||
for users to open. Each note contains three parts: scene index, title and content. The note index will be automatically set according to the current scene that | ||
user is investigating. Note tile and content are fulfilled by users. Default title will be given if user does not give a title. User can also search for an | ||
existing note by either search its title/scene index or directly open it by its sequence number (in the note list). User can also delete the unwanted notes by | ||
typing in its sequence number. | ||
|
||
### SuspectListBuilder | ||
|
||
Suspects and clues used in different scenes can be kept in a txt file and created following a specific format. | ||
It uses `java.io.File`, `java.util.Scanner`, and is implemented as: | ||
* `suspectListBuilder(String fileLocation, SuspectList suspectList)` -- where `fileLocation` is the directory | ||
containing the specified text file and `suspectList` is the instance of class `SuspectList` that the suspects | ||
and clues are to be added into. | ||
|
||
This method will search for the specified text file, throwing a `FileNotFoundException` if it is missing. | ||
The text file will be written in such a way that the program can recognize how many suspects | ||
and how many clues there are. It will first add the suspects from the file into the suspectList | ||
via the method `addSuspect(String suspectName, Suspect suspect)`, and then the clues via the | ||
method `addClueForSuspect(String suspectName, Clue clueToAdd)` to the suspect with the corresponding `suspectName`. | ||
|
||
|
||
|
||
## Appendix | ||
|
||
## Product Scope | ||
|
||
**Target user profile:** | ||
|
||
- enjoy the playing interactive game | ||
- enjoy mystery genre | ||
- enjoy reading | ||
- wants to take a break from visual games | ||
|
||
|
||
**Value proposition:** | ||
|
||
- Provide an alternative game for users to exercise creative thinking | ||
|
||
## Use Cases | ||
|
||
(Use /next as an example) | ||
|
||
## User Stories | ||
|
||
|Version| As a ... | I want to ... | So that I can ...| | ||
|--------|----------|---------------|------------------| | ||
|v1.0|new user|see usage instructions|refer to them when I forget how to use the application| | ||
|v2.0|user|find a to-do item by name|locate a to-do without having to go through the entire list| | ||
|Priority|Version| As a ... | I want to ... | So that I can ...| | ||
|--------|--------|----------|---------------|------------------| | ||
| * * *|v1.0|new user|see all commands available|understand the game mechanics| | ||
| * * *|v1.0|user|investigate the suspects available|better understand the suspect| | ||
| * * *|v1.0|user|investigate the clues available|understand the story line better| | ||
| * * *|v1.0|user|choose the suspect|see if I am able to solve the crime| | ||
| * * |v2.0|user|resume the game after exiting|continue the game instead of restarting| | ||
| * * |v2.0|user|write notes|look at the notes I have written for each scene and suspect| | ||
| * |v2.0|user|go to previous scene|look at the narrative for the previous scene| | ||
|
||
|
||
### Use Cases | ||
|
||
(Use /next as an example) | ||
|
||
Use case: Navigate to the next scene. | ||
|
||
1. The user gives `/next` as input. | ||
2. Parser parsed the `/next` input, returns a NextCommand. | ||
3. NextCommand does a self-invocation and calls the `execute()` method. | ||
4. NextCommand returns a boolean by self-invocating the `.exit()` method. | ||
5. If it is the last scene of the game, `.exit()` returns true else false. | ||
|
||
### Non-Functional Requirements | ||
1. The game should work as long as java 11 is installed on the local machine. | ||
2. A working keyboard to play the game and a monitor to read the text. | ||
|
||
## Non-Functional Requirements | ||
|
||
{Give non-functional requirements} | ||
### Glossary | ||
|
||
## Glossary | ||
|
||
* *glossary item* - Definition | ||
- Mainstream OS: Windows, Mac OS X, Unix, Linux | ||
|
||
## Instructions for manual testing | ||
## Appendix: Instructions for manual testing | ||
|
||
{Give instructions on how to do a manual product testing e.g., how to load sample data to be used for testing} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
---------------- | ||
| Instructions | | ||
---------------- | ||
|
||
Here are the commands that you can enter: | ||
"/help" - view this command list | ||
"/exit" - exit the game | ||
"/next" - move on to the next scene or the next stage of a scene | ||
"/back" - go back to previous scene | ||
"/note" - create a new note/ open a note/ delete a note | ||
"/view" - view all the clues that you have gathered | ||
"/restart" - restart the game from beginning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps add the appropriate links to correct the navigation as currently, it does not navigate to the correct sub-header.