admin: Added contribution, originality and code review

This commit is contained in:
Nathan Woodburn 2023-05-01 17:49:54 +10:00
parent b8487c3c08
commit 0a69fe6555
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
3 changed files with 57 additions and 17 deletions

View File

@ -8,8 +8,8 @@ declaration: >-
# be 100 or 99 (33/33/33 is fine). (Remove entries if you have fewer than three
# members).
contributions:
- uid:
contribution:
- uid: u7156831
contribution: 33
- uid:
contribution:
- uid: u7280427
@ -18,8 +18,8 @@ contributions:
# Sign *your* name and uids here. (Remove entries if you have fewer
# than three members)
signatures:
- name:
uid:
- name: Nathan Woodburn
uid: u7156831
- name:
uid:
- name: Immanuel Alvaro Bhirawa

View File

@ -19,9 +19,9 @@ declaration: >-
#
# Add as many "name+comment" entries as necessary
# (or remove it altogether if you haven't collaborated with anyone)
collaboration:
- name:
comment: >-
# collaboration:
# - name:
# comment: >-
# Use this to list any code that you used that you did not write,
# aside from code provided by the lecturer. Provide a comment
@ -30,10 +30,10 @@ collaboration:
#
# Add as many "url+licence+comment" entries as necessary
# (or remove it altogether if you haven't used any external code)
code:
- comment:
url:
licence:
# code:
# - comment:
# url:
# licence:
# Use this to list any assets (artwork, sound, etc) that you used.
# Provide a comment explaining your use of that asset and the URL
@ -41,17 +41,17 @@ code:
#
# Add as many "url+licence+comment" entries as necessary
# (or remove it altogether if you haven't used any external assets)
assets:
- comment:
url:
licence:
# assets:
# - comment:
# url:
# licence:
# Sign *your* name and uids here. (Remove entries if you have fewer
# than three members.)
signatures:
- name:
uid:
- name: Nathan Woodburn
uid: u7156831
- name:
uid:
- name:

View File

@ -0,0 +1,40 @@
## Code Review
Reviewed by: Nathan Woodburn, u7156831
Reviewing code written by: Immanuel Alvaro Bhirawa, u7280427
Component: `isMoveValid` from [BlueLagoon.java L145-L311](https://gitlab.cecs.anu.edu.au/u7156831/comp1110-ass2/-/blob/master/src/comp1110/ass2/BlueLagoon.java#L145-L311)
### Comments
- Good practices used:
- Using other functions to help with the main function, such as `isStateStringWellFormed` and `isMoveStringWellFormed`.
- Using good variable names such as `currentPhase` and `boardHeight`
- Using a `switch case` statement instead of multiple `if` statements.
- Using `.addAll()` to add multiple elements to an arraylist instead of iterating through each element and adding them
- Good use of `for` loops to iterate through arrays
- Places to improve:
- Some comments are not needed, such as commenting about well named variables.
```java
int numberOfPlayer = 0; // Number of player
String playerId = ""; // Player ID
```
- Duplicate code could be avoided. For example [this switch](https://gitlab.cecs.anu.edu.au/u7156831/comp1110-ass2/-/blob/b8487c3c0826bef4e676a13f8ea05c578c73d2de/src/comp1110/ass2/BlueLagoon.java#L231-L256) could be shortened to the below to avoid duplicate code.
```java
switch (numberOfPlayer) {
case 4 -> numberOfSettlersPerPlayer = 20;
case 3 -> numberOfSettlersPerPlayer = 25;
case 2 -> numberOfSettlersPerPlayer = 30;
}
if (pieceType.equals("S")) {
if (settlerCounter + 1 > numberOfSettlersPerPlayer) return false;
} else if (pieceType.equals("T")) {
if (villageCounter + 1 > numberOfVillagesPerPlayer) return false;
}
```
- A few parts of code could be moved outside of the loop to improve efficiency and speed. For example the above snippet could be moved to the part of the code where numberOfPlayer is set.
- Possible errors
- `numberOfSettlersPerPlayer -= 10;` (and the `-5` version) could create the incorrect number as this is inside a loop. This could be avoided by setting the variable to a constant value instead of subtracting 10 each time.