This repository was archived by the owner on Oct 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Maria_Voronko #37
Open
MariWrnk
wants to merge
57
commits into
master
Choose a base branch
from
feature/MariaVoronko
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Maria_Voronko #37
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
fbe96c1
Update Main
MariWrnk 1397302
Gitignore update
MariWrnk e0cce8b
Gitignore update 2
MariWrnk 43970c3
Add homework 1
MariWrnk abff6f7
Update
MariWrnk 1a59785
Update README.md
MariWrnk b4298b6
Style fix
MariWrnk abb0216
Pyramid Printer
MariWrnk 3a09f3f
Pyramid Printer done
MariWrnk aa7e294
Traffic light
MariWrnk b62a3a8
Random Chars Table
MariWrnk 0dec122
README update
MariWrnk bdf3eff
Traffic Light add mode
MariWrnk ca9fc3e
README update
MariWrnk 5730a8d
Merge remote-tracking branch 'origin/master' into Feature/MariaVoronko
MariWrnk e74728a
PyramidPrinter hw3
MariWrnk bcf657b
RandomCharsTable add classes
MariWrnk 8e59c3a
PyramidPrinter error message fix
MariWrnk ea61e8e
PyramidPrinter tests fix
MariWrnk fc31c5c
RandomCharsTable tests
MariWrnk c582fe9
PyramidPrinter tests fix
MariWrnk 38d7e09
TrafficLight tests
MariWrnk eb53c5e
Add link to codingbat
MariWrnk 2137346
Immutable class
MariWrnk f671dbc
RandomCharsTableCreator update
MariWrnk ac5c12c
TrafficLight add ExtraMode
MariWrnk 81e2f7c
README add HW3
MariWrnk d02a92b
HW2 style fix
MariWrnk 71a7349
README add hw2 tests link
MariWrnk ff8a35c
HW2 tests update
MariWrnk b7edb8e
HW4 CustomFileReader done
MariWrnk 23cfe1a
HW4 CustomFileReader tests
MariWrnk 4e4bcb7
HW4 Singleton done
MariWrnk 3de36b4
HW4 CustomAnnotation done
MariWrnk bf3d4c6
README add HW4
MariWrnk 84e00e4
HW2 style update
MariWrnk 7e5b2a3
HW5 PowerOfNumber done
MariWrnk 123c6b4
HW5 PowerOfNumber fix
MariWrnk 73191e1
HW5 CustomRegexMatcher done
MariWrnk 36a3eee
HW5 PowerOfNumberTest fix
MariWrnk 4f126e8
HW6 done
MariWrnk 03f1278
README.md update
MariWrnk 934190a
HW2 style fix
MariWrnk a7bcd75
HW5 PowerOfNumber validation fix
MariWrnk 171ccfb
HW7 done
MariWrnk 2297a5d
README.md update
MariWrnk 59a2f5e
SeaBattle done
MariWrnk b4d6100
SeaBattle style fix
MariWrnk 965218d
SeaBattle Tests done
MariWrnk 0db95e0
README.md update
MariWrnk b1704c6
SeaBattle style fix
MariWrnk 0bdfe50
SeaBattle tests add
MariWrnk 4ef8478
HW3 bug fix
MariWrnk c5de362
SeaBattle interface fix
MariWrnk c3c7561
SeaBattle print field
MariWrnk bd25d14
SeaBattle bug fix
MariWrnk 6b6e7a2
SeaBattle bug fix
MariWrnk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,28 @@ | ||
| # Java Core June 2021 | ||
|
|
||
| ## *Nikolaev Artem* | ||
| ## *Maria Voronko* | ||
|
|
||
| | Number | Solution | Short description | ||
| | --- | --- | --- | | ||
| | HW1 | [Console printer](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/master/src/main/java/homework_1) | The app that reads input arguments and prints them, until "error" argument | | ||
| | HW1 | [Console printer](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/MariaVoronko/src/main/java/homework_1/HomeWork1.java) | The app that reads input arguments and prints them, until "error" argument. | | ||
| | HW2 | [Traffic Light](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/MariaVoronko/src/main/java/homework_2/traffic_light) | The app that reads a number of seconds from the beginning of the day and prints traffic light color at that moment. | | ||
| | HW2 | [Pyramid Printer](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/MariaVoronko/src/main/java/homework_2/pyramid_printer/PyramidPrinter.java) | The app that reads pyramid size and prints pyramid of 'x' of given size. | | ||
| | HW2 | [Random Chars Table](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/MariaVoronko/src/main/java/homework_2/random_chars_table/RandomCharsTable.java) | The app that prints a table of random chars and finds odd or even letters in it. | | ||
| | HW2 | [Tests 2](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/MariaVoronko/src/test/java/homework_2) | Tests for homework 2. | | ||
| | HW3 | [Immutable Class](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/MariaVoronko/src/main/java/homework_3/ImmutableCat.java) | To create an immutable class and write its requirements in comments. | | ||
| | HW4 | [Custom File Reader](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/MariaVoronko/src/main/java/homework_4/custom_file_reader) | The app that reads data from file and prints it to the console. | | ||
| | HW4 | [Singleton](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/MariaVoronko/src/main/java/homework_4/singleton) | Singleton design pattern implementation. | | ||
| | HW4 | [Custom Annotation](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/MariaVoronko/src/main/java/homework_4/custom_annotation) | Annotation. | | ||
| | HW4 | [Tests 4](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/MariaVoronko/src/test/java/homework_4) | Tests for homework 4. | | ||
| | HW5 | [CustomRegexMatcher](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/MariaVoronko/src/main/java/homework_5/custom_regex_mathcer) | The app that checks if input string matches pattern. | | ||
| | HW5 | [PowerOfNumber](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/MariaVoronko/src/main/java/homework_5/power_of_number) | The app that calculates a number in a power using recursion. | | ||
| | HW5 | [Tests 5](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/MariaVoronko/src/test/java/homework_5) | Tests for homework 5. | | ||
| | HW6 | [MapProblemsCollisionGenerator & MapProblemMutableGenerator](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/MariaVoronko/src/main/java/homework_6) | Classes that create problems in HashMap. | | ||
| | HW7 | [KittenToCatFunction](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/MariaVoronko/src/main/java/homework_7) | The functional interface with an abstract method that turns a Kitten to a Cat. | | ||
| | HW7 | [Tests 7](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/MariaVoronko/src/test/java/homework_7) | Tests for homework 7. | | ||
| | Course Project | [Sea Battle](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/MariaVoronko/src/main/java/course_project) | The app tht plays Sea Battle game with user. | | ||
| | Course Project | [Tests](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/MariaVoronko/src/test/java/course_project) | Tests for Sea Battle. | | ||
|
|
||
| [Link to CodingBat](https://codingbat.com/done?user=mari.waranko@gmail.com&tag=3702089539) | ||
|
|
||
| [Link to markdown giude](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package course_project; | ||
|
|
||
| import course_project.services.GameService; | ||
|
|
||
| public class Main { | ||
|
|
||
| public static void main(String[] args) { | ||
| new GameService().run(); | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package course_project.enums; | ||
|
|
||
| public enum CellStatus { | ||
|
|
||
| FREE, | ||
| HAS_SHIP, | ||
| VISITED, | ||
| NOT_VISITED | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package course_project.enums; | ||
|
|
||
| public enum Response { | ||
|
|
||
| MISSED, | ||
| HIT, | ||
| KILLED, | ||
| VISITED | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| package course_project.objects; | ||
|
|
||
| import course_project.enums.CellStatus; | ||
|
|
||
| import static course_project.enums.CellStatus.*; | ||
|
|
||
| public class Cell { | ||
|
|
||
| private final CellStatus status; | ||
| private final boolean gotShip; | ||
|
|
||
| public Cell(CellStatus status, boolean gotShip) { | ||
| this.status = status; | ||
| this.gotShip = gotShip; | ||
| } | ||
|
|
||
| public CellStatus getStatus() { | ||
| return status; | ||
| } | ||
|
|
||
| public boolean hadShip() { | ||
| return gotShip; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| if (status == VISITED) { | ||
| if(gotShip) { | ||
| return "X"; | ||
| } | ||
| return "e"; | ||
| } | ||
| return "-"; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| package course_project.objects; | ||
|
|
||
| import course_project.enums.CellStatus; | ||
| import course_project.enums.Response; | ||
| import course_project.objects.Move; | ||
| import course_project.objects.fields.ComputerField; | ||
| import course_project.objects.fields.Field; | ||
| import course_project.objects.fields.UserField; | ||
| import course_project.services.ShipLocationGenerator; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public class GameData { | ||
|
|
||
| private final ComputerField computerField; | ||
| private final UserField userField; | ||
| private int computerShips = 10; | ||
| private int userShips = 10; | ||
|
|
||
| public GameData(ShipLocationGenerator generator) { | ||
| computerField = generator.generateShips(); | ||
| userField = new UserField(); | ||
| } | ||
|
|
||
| public ComputerField getComputerField() { | ||
| return computerField; | ||
| } | ||
|
|
||
| public Field getUserField() { | ||
| return userField; | ||
| } | ||
|
|
||
| public int getComputerShips() { | ||
| return computerShips; | ||
| } | ||
|
|
||
| public int getUserShips() { | ||
| return userShips; | ||
| } | ||
|
|
||
| public Response getResponseFromComputer(Move move) { | ||
| Response response = computerField.getResponse(move); | ||
| if (response == Response.KILLED) { | ||
| computerShips--; | ||
| } | ||
| return response; | ||
| } | ||
|
|
||
| public void saveComputerMoveResult(Response response, Move move, List<Move> lastHit) { | ||
| if (response == Response.KILLED) { | ||
| userField.setVisitedAroundShip(lastHit); | ||
| userShips--; | ||
| } | ||
| userField.setCellStatus(move.getX(), move.getY(), CellStatus.VISITED); | ||
| } | ||
|
|
||
| public boolean isUserFleetEmpty() { | ||
| return userShips == 0; | ||
| } | ||
|
|
||
| public boolean isComputerFleetEmpty() { | ||
| return computerShips == 0; | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package course_project.objects; | ||
|
|
||
| public class Move { | ||
|
|
||
| private final int x; | ||
| private final int y; | ||
|
|
||
| public Move(int x, int y) { | ||
| this.x = x; | ||
| this.y = y; | ||
| } | ||
|
|
||
| public Move(String move) { | ||
| x = move.charAt(0) - 65; | ||
| y = Integer.parseInt(move.substring(1)) - 1; | ||
| } | ||
|
|
||
| public int getX() { | ||
| return x; | ||
| } | ||
|
|
||
| public int getY() { | ||
| return y; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return (char) (x + 65) + "" + (y + 1); | ||
| } | ||
| } |
85 changes: 85 additions & 0 deletions
85
src/main/java/course_project/objects/fields/ComputerField.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| package course_project.objects.fields; | ||
|
|
||
| import course_project.enums.CellStatus; | ||
| import course_project.enums.Response; | ||
| import course_project.objects.Cell; | ||
| import course_project.objects.Move; | ||
| import course_project.objects.fields.Field; | ||
|
|
||
| import java.util.Arrays; | ||
|
|
||
| public class ComputerField extends Field { | ||
|
|
||
| public ComputerField() { | ||
| for (Cell[] row : table) { | ||
| Arrays.fill(row, new Cell(CellStatus.FREE, false)); | ||
| } | ||
| } | ||
|
|
||
| public Response getResponse(Move move) { | ||
| if (table[move.getX()][move.getY()].getStatus() == CellStatus.FREE) { | ||
| table[move.getX()][move.getY()] = new Cell(CellStatus.VISITED, false); | ||
| return Response.MISSED; | ||
| } | ||
| if (table[move.getX()][move.getY()].getStatus() == CellStatus.VISITED) { | ||
| return Response.VISITED; | ||
| } | ||
| if (table[move.getX()][move.getY()].getStatus() == CellStatus.HAS_SHIP) { | ||
| table[move.getX()][move.getY()] = new Cell(CellStatus.VISITED, true); | ||
| int x = move.getX(); | ||
| int y = move.getY(); | ||
| if (hasShipAround(x, y)) { | ||
| return Response.HIT; | ||
| } | ||
| int prevX = -1; | ||
| int prevY = -1; | ||
| while (true) { | ||
| if (x != 0 && x - 1 != prevX && table[x - 1][y].getStatus() == CellStatus.VISITED && table[x - 1][y].hadShip()) { | ||
| prevX = x; | ||
| x--; | ||
| continue; | ||
| } | ||
| if (x + 1 < 10 && x + 1 != prevX && table[x + 1][y].getStatus() == CellStatus.VISITED && table[x + 1][y].hadShip()) { | ||
| prevX = x; | ||
| x++; | ||
| continue; | ||
| } | ||
| if (y != 0 && y - 1 != prevY && table[x][y - 1].getStatus() == CellStatus.VISITED && table[x][y - 1].hadShip()) { | ||
| prevY = y; | ||
| y--; | ||
| continue; | ||
| } | ||
| if (y + 1 < 10 && y + 1 != prevY && table[x][y + 1].getStatus() == CellStatus.VISITED && table[x][y + 1].hadShip()) { | ||
| prevY = y; | ||
| y++; | ||
| continue; | ||
| } | ||
| if (hasShipAround(x, y)) { | ||
| return Response.HIT; | ||
| } | ||
| break; | ||
| } | ||
| } | ||
| return Response.KILLED; | ||
| } | ||
|
|
||
| private boolean hasShipAround(int x, int y) { | ||
| return (x != 0 && table[x - 1][y].getStatus() == CellStatus.HAS_SHIP) | ||
| || (x + 1 < table.length && table[x + 1][y].getStatus() == CellStatus.HAS_SHIP) | ||
| || (y != 0 && table[x][y - 1].getStatus() == CellStatus.HAS_SHIP) | ||
| || (y + 1 < table[0].length && table[x][y + 1].getStatus() == CellStatus.HAS_SHIP); | ||
| } | ||
|
|
||
| public void printField() { | ||
| System.out.println("Computer's field:"); | ||
| System.out.println(" 1 2 3 4 5 6 7 8 9 10"); | ||
| for (int i = 0; i < 10; i++) { | ||
| System.out.print((char) (i + 65)); | ||
| System.out.println(Arrays.toString(table[i])); | ||
| } | ||
| System.out.println("\tX - computer's ship you've destroyed."); | ||
| System.out.println("\te - empty cell you've checked."); | ||
| System.out.println("\t- - a cell you've not checked."); | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| package course_project.objects.fields; | ||
|
|
||
| import course_project.enums.CellStatus; | ||
| import course_project.objects.Cell; | ||
|
|
||
| import java.util.Arrays; | ||
|
|
||
| public abstract class Field { | ||
|
|
||
| protected final Cell[][] table = new Cell[10][10]; | ||
|
|
||
| public CellStatus getCellStatus(int x, int y) { | ||
| return table[x][y].getStatus(); | ||
| } | ||
|
|
||
| public void setCellStatus(int x, int y, CellStatus newStatus) { | ||
| if (newStatus == CellStatus.HAS_SHIP) { | ||
| table[x][y] = new Cell(newStatus, true); | ||
| } else { | ||
| table[x][y] = new Cell(newStatus, false); | ||
| } | ||
| } | ||
|
|
||
| public void printField() { | ||
| for (Cell[] row : table) { | ||
| System.out.println(Arrays.toString(row)); | ||
| } | ||
| } | ||
| } |
65 changes: 65 additions & 0 deletions
65
src/main/java/course_project/objects/fields/UserField.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| package course_project.objects.fields; | ||
|
|
||
| import course_project.enums.CellStatus; | ||
| import course_project.objects.Cell; | ||
| import course_project.objects.Move; | ||
| import course_project.objects.fields.Field; | ||
|
|
||
| import java.util.Arrays; | ||
| import java.util.Collections; | ||
| import java.util.Comparator; | ||
| import java.util.List; | ||
|
|
||
| public class UserField extends Field { | ||
|
|
||
| public UserField() { | ||
| for (Cell[] row : table) { | ||
| Arrays.fill(row, new Cell(CellStatus.NOT_VISITED, false)); | ||
| } | ||
| } | ||
|
|
||
| public void setVisitedAroundShip(List<Move> list) { | ||
| boolean isSameX = false; | ||
| if (list.size() == 1 || list.get(0).getX() == list.get(1).getX()) { | ||
| isSameX = true; | ||
| } | ||
| if (isSameX) { | ||
| Comparator<Move> byY = Comparator.comparing(Move::getY); | ||
| list.sort(byY); | ||
| int x = list.get(0).getX(); | ||
| int y1 = list.get(0).getY(); | ||
| int y2 = list.get(list.size() - 1).getY(); | ||
| for (int y = y1 - 1; y <= y2 + 1; y++) { | ||
| if (!(0 <= y && y < 10)) { | ||
| continue; | ||
| } | ||
| setCellStatus(x, y, CellStatus.VISITED); | ||
| if (x - 1 >= 0) { | ||
| setCellStatus(x - 1, y, CellStatus.VISITED); | ||
| } | ||
| if (x + 1 < 10) { | ||
| setCellStatus(x + 1, y, CellStatus.VISITED); | ||
| } | ||
| } | ||
| } else { | ||
| Comparator<Move> byX = Comparator.comparing(Move::getX); | ||
| list.sort(byX); | ||
| int y = list.get(0).getY(); | ||
| int x1 = list.get(0).getX(); | ||
| int x2 = list.get(list.size() - 1).getX(); | ||
| for (int x = x1 - 1; x <= x2 + 1; x++) { | ||
| if (!(0 <= x && x < 10)) { | ||
| continue; | ||
| } | ||
| setCellStatus(x, y, CellStatus.VISITED); | ||
| if (y - 1 >= 0) { | ||
| setCellStatus(x, y - 1, CellStatus.VISITED); | ||
| } | ||
| if (y + 1 < 10) { | ||
| setCellStatus(x, y + 1, CellStatus.VISITED); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.
I really don't understand what happened. It seems the interface needs refactoring. Also, it would be better if you add visual field representation
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.
There's much repetitive code, and it makes reading code harder
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.
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.
Here a bug again...

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.
But the interface was refactored, although I couldn't continue to play
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.
Good, I didn't find any bugs! As optional improvement, marking cells around a sunk ship as hit is a good idea. Approved!