Conversation
add StringBuilder remove case 5-9,0
rename MyApp.java -> Main.java
…chik # Conflicts: # README.md # src/main/java/homework_1/Main.java
|
|
||
| public class Wrapper <T> implements Problem<T> { | ||
| private final Problem<T> innerProblem; | ||
| private final List<String> event = new ArrayList<>(); |
There was a problem hiding this comment.
Good implementation for generating events!
|
|
||
| public static void main(String[] args) { | ||
| Kitten kitten = new Kitten("Murzik", 1); | ||
| KittenToCatFunction function = (k) -> new Cat(k.getName(), k.getAge() + 4); |
There was a problem hiding this comment.
Opt: you could add some more complicated logic to lambda, as example - converting one type to another (like, favourite toy to favourite color or smth like this)
|
|
||
| import course_project.sea_battle.controller.impl.GameControllerImpl; | ||
|
|
||
| public class SeaBattleApp { |
There was a problem hiding this comment.
The game seems not working. I see you implemented PvP, but I play only for 1 Player. I don't see field for 2nd, don't see his name anywhere. Don't know how to shoot for 2nd.
And please introduce automatic ship placement, testing will be much easier
There was a problem hiding this comment.
Good! Nice architecture, SOLID is followed. Code is pretty readable. Good Java Core and Java libraries usage.
To make better: interface could be refactored. Also check correct working of the game.
There was a problem hiding this comment.
Also nice approach to testing, test cases are readable
There was a problem hiding this comment.
Good, automatic ship placement! I found some minor issues with the interface:
- When miss, there's no message to press enter to finish the turn. Actually, I didn't see this message anywhere... Confusing
- In case i hit a ship, i need to press enter 2 times to be able to shoot again
- No error message in case I already shot this cell

- No message in case of destroyed ship

- And please make field representation wider :)
The app now works correctly, I didn't find any bugs. And from the code perspective, the app looks great!
To make better: improve interface:)
The homework is approved
NikolaevArtem
left a comment
There was a problem hiding this comment.
Nice! The code needs small fixes, but except that - good job! The architecture is nice, and I see you exercised with inheritance/generics, which is cool. But remember that it's nice for learning purposes, but production code, at best, should be readable and simple first. Usually, when there's a choice between SOLID or readability/simplicity, I choose second. IMHO
| try { | ||
| run1(); | ||
| } catch (IOException e) { | ||
| e.printStackTrace(); | ||
| } | ||
| try { | ||
| run2(); | ||
| } catch (IOException e) { | ||
| e.printStackTrace(); | ||
| } | ||
| try { | ||
| run3(); | ||
| } catch (IOException e) { | ||
| e.printStackTrace(); | ||
| } | ||
| try { | ||
| run4(); | ||
| } catch (IOException e) { | ||
| e.printStackTrace(); | ||
| } |
There was a problem hiding this comment.
Opt: these try-catch now are either not needed or not in right place...

No description provided.