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
Krylosov_Arkady #33
Open
KrArkadiy
wants to merge
67
commits into
master
Choose a base branch
from
feature/KrylosovArkady
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
Krylosov_Arkady #33
Changes from all commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
b0e8b31
gitignore updated
KrArkadiy ecddcf0
gitignore updated
KrArkadiy 1df4806
Delete Main.java
KrArkadiy 8a07313
homework_2 done.
KrArkadiy 528cd6f
homework_2 done.
KrArkadiy e3775d8
homework_2 done.
KrArkadiy 0e704da
homework_2 done.
KrArkadiy 5aa7e96
homework_2 done.
KrArkadiy 4d575f2
README updated
KrArkadiy d41b249
Update Strategy.java
KrArkadiy e2a0229
Add UnitBase.java
ArtemNikolaev1 ede0736
homework_2 corrected
KrArkadiy 579a708
homework_2 corrected
KrArkadiy 385c677
homework_2 corrected
KrArkadiy 14677e0
Merge remote-tracking branch 'origin/feature/KrylosovArkady' into fea…
KrArkadiy 7f07dad
Delete Strategy.java
KrArkadiy 1a6933d
README updated
KrArkadiy 4f3efcd
Update README.md
KrArkadiy 835d06c
Update README.md
KrArkadiy a186e54
Merge remote-tracking branch 'origin/feature/KrylosovArkady' into fea…
KrArkadiy 42abc65
README updated
KrArkadiy a9b9d09
package naming corrected
KrArkadiy 4019fa6
Update README.md
KrArkadiy ad9cbb3
Update README.md
KrArkadiy c88d878
UnitBase merged
KrArkadiy 3fcf714
Delete UnitBase.java
KrArkadiy 988376a
gitignore updated
KrArkadiy 0f600b5
gitignore updated
KrArkadiy 3e1d995
Delete Main.java
KrArkadiy 231c3e9
homework_2 done.
KrArkadiy 30b783e
homework_2 done.
KrArkadiy 6bba878
homework_2 done.
KrArkadiy ea7c10a
homework_2 done.
KrArkadiy 566d965
homework_2 done.
KrArkadiy 5d27087
README updated
KrArkadiy eb00857
homework_2 corrected
KrArkadiy 88d84b0
homework_2 corrected
KrArkadiy 4926d1e
homework_2 corrected
KrArkadiy cb73022
Update Strategy.java
KrArkadiy bda3432
README updated
KrArkadiy 5d6eafc
Delete Strategy.java
KrArkadiy 2aed539
Update README.md
KrArkadiy d84e24c
Update README.md
KrArkadiy b9dac9f
README updated
KrArkadiy 68fac53
package naming corrected
KrArkadiy fbecf0b
Update README.md
KrArkadiy 44764f4
Update README.md
KrArkadiy 2756dea
UnitBase merged
KrArkadiy f9a8a46
Delete UnitBase.java
KrArkadiy 0e076f4
UnitBase merged
KrArkadiy 87529e8
Merge branch 'feature/KrylosovArkady'
KrArkadiy dcb4e0a
UnitBase merged
KrArkadiy a54053f
Update UnitBase.java
KrArkadiy 3d8a1fa
homework_2 correction
KrArkadiy e6a7eea
Merge remote-tracking branch 'origin/feature/KrylosovArkady' into fea…
KrArkadiy d4ef7cb
homework_2 correction
KrArkadiy fb46f53
homework_3 correction
KrArkadiy 478cf57
homework_4 realization
KrArkadiy 239bf04
homework_4 realization
KrArkadiy 55c43a8
homework_4 tests realization
KrArkadiy ab773e1
README updated
KrArkadiy 7f594b2
homework_2,4 fixed.
KrArkadiy 2cf9724
homework 5 done.
KrArkadiy ab37ecc
homework 6 done.
KrArkadiy 18ae0d6
homework 7 and course project done.
KrArkadiy 2bd2afd
course project fixed
KrArkadiy fe79848
course project fixed
KrArkadiy 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,19 @@ | ||
| # Java Core June 2021 | ||
|
|
||
| ## *Nikolaev Artem* | ||
| ## *Krylosov Arkadiy* | ||
|
|
||
| | 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 | | ||
|
|
||
| [Link to markdown giude](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) | ||
| | HW1 | [Console printer](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/KrylosovArkady/src/main/java/homework_1) | The app that reads input arguments and prints them, until "error" argument | | ||
| | HW2.1 | [Traffic Light](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/KrylosovArkady/src/main/java/homework_2/traffic_light) | The app that reads input arguments and output, what traffic light color it would be in inputted time. User has an opportunity to enter time in 2 formats | | ||
| | HW2.2 | [Pyramid Printer](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/KrylosovArkady/src/main/java/homework_2/pyramid_printer) | The app that reads input arguments and prints a pyramid of "x" according to the entered positive integer| | ||
| | HW2.3 | [Random Chars Table](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/KrylosovArkady/src/main/java/homework_2/random_chars_table) | The app that reads input arguments and prints an array and a String of even of odd letters, result depends on chosen strategy| | ||
| | HW3 | [Immutable class](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/KrylosovArkady/src/main/java/homework_3) | Example of immutable class| | ||
| | HW4.1 | [Custom File Reader](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/KrylosovArkady/src/main/java/homework_4/custom_file_reader) |The app that reads file 3 different ways and print the result into console | | ||
| | HW4.2 | [My annotation](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/KrylosovArkady/src/main/java/homework_4/custom_annotation) | My custom annotation that allows to put annotated fields into JSON file| | ||
| | HW4.3 | [Singleton](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/KrylosovArkady/src/main/java/homework_4/singleton) |Example of singleton design pattern | | ||
| | HW5.1 | [Power of Number](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/KrylosovArkady/src/main/java/homework_5/power_of_number) |The app that raises to the power of input using recursion | | ||
| | HW5.2 | [Custom regex matcher](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/KrylosovArkady/src/main/java/homework_5/custom_regex_matcher) |The app that simulate password regex matcher | | ||
| | HW6 | [Map problems generator](https://github.com/NikolaevArtem/Java_Core_June_2021/tree/feature/KrylosovArkady/src/main/java/homework_6/map_problems_generator) |Example of problems that may occur if contract of equals & hashCode are not followed and if mutable class if used as a key | | ||
| [Link to codingBat](https://codingbat.com/done?user=krylosov.arkady@yandex.ru&tag=8157289593) | ||
| [Link to markdown guide](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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package course_project; | ||
|
|
||
| import course_project.service.Runner; | ||
|
|
||
| public class Main { | ||
| public static void main(String[] args) { | ||
| Runner runner = new Runner(); | ||
| runner.run(); | ||
| } | ||
|
|
||
| } | ||
8 changes: 8 additions & 0 deletions
8
src/main/java/course_project/custom_exceptions/CoordinatesNumber.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,8 @@ | ||
| package course_project.custom_exceptions; | ||
|
|
||
| public class CoordinatesNumber extends Exception{ | ||
|
|
||
| public CoordinatesNumber() { | ||
| super("Number of coordinates don't fit ship length"); | ||
| } | ||
| } |
8 changes: 8 additions & 0 deletions
8
src/main/java/course_project/custom_exceptions/InvalidShip.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,8 @@ | ||
| package course_project.custom_exceptions; | ||
|
|
||
| public class InvalidShip extends Exception { | ||
|
|
||
| public InvalidShip() { | ||
| super("Invalid place for ship! It should be horizontal, vertical and solid structure"); | ||
| } | ||
| } |
8 changes: 8 additions & 0 deletions
8
src/main/java/course_project/custom_exceptions/PlaceNotFree.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,8 @@ | ||
| package course_project.custom_exceptions; | ||
|
|
||
| public class PlaceNotFree extends Exception { | ||
|
|
||
| public PlaceNotFree() { | ||
| super("Invalid place for ship: this place is already occupied by another ship or another ship is too close"); | ||
| } | ||
| } |
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,19 @@ | ||
| package course_project.model; | ||
|
|
||
| import java.util.Arrays; | ||
|
|
||
| public class Battlefield { | ||
| private Designation[][] grid; | ||
|
|
||
| public Battlefield() { | ||
| grid = new Designation[11][11]; | ||
| for (Designation[] cell : grid) { | ||
| Arrays.fill(cell, Designation.EMPTY); | ||
| } | ||
| } | ||
|
|
||
| public Designation[][] getGrid() { | ||
| return grid; | ||
| } | ||
|
|
||
| } |
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.model; | ||
|
|
||
| public enum Designation { | ||
| SHIP("◾", 0), | ||
| FOUR_DECKER("", 4), | ||
| THREE_DECKER("", 3), | ||
| TWO_DECKER("", 2), | ||
| ONE_DECKER("", 1), | ||
| HIT("x", 0), | ||
| EMPTY("~", 0), | ||
| MISS("*", 0), | ||
| GAP("o", 0); | ||
|
|
||
| private String sign; | ||
| private int length; | ||
|
|
||
| Designation(String sign, int length) { | ||
| this.sign = sign; | ||
| this.length = length; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return sign; | ||
| } | ||
|
|
||
| public int getLength() { | ||
| return length; | ||
| } | ||
| } |
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,56 @@ | ||
| package course_project.model; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.Scanner; | ||
|
|
||
| public class Player { | ||
|
|
||
| private Battlefield myField; | ||
| private Battlefield enemyField; | ||
| private String name; | ||
| private int shipsAmount; | ||
|
|
||
| public Player() { | ||
| myField = new Battlefield(); | ||
| enemyField = new Battlefield(); | ||
| shipsAmount = 10; | ||
| } | ||
|
|
||
| public void setName(String name) { | ||
| this.name = name; | ||
| } | ||
|
|
||
| public String getName() { | ||
| return this.name; | ||
| } | ||
|
|
||
|
|
||
|
|
||
| public Designation[][] getGrid() { | ||
| return myField.getGrid(); | ||
| } | ||
|
|
||
| public Battlefield getField() { | ||
| return this.myField; | ||
| } | ||
|
|
||
| public Battlefield getEnemyField() { | ||
| return this.enemyField; | ||
| } | ||
|
|
||
| public void setMyField(Battlefield myField) { | ||
| this.myField = myField; | ||
| } | ||
|
|
||
| public void setEnemyField(Battlefield enemyField) { | ||
| this.enemyField = enemyField; | ||
| } | ||
|
|
||
| public int getShipsAmount() { | ||
| return shipsAmount; | ||
| } | ||
|
|
||
| public void setShipsAmount(int shipsAmount) { | ||
| this.shipsAmount = shipsAmount; | ||
| } | ||
| } |
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.
Seems broken:

Also, please introduce automatic ship placement
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.
Also, if input is wrong, the app just shuts down. Really annoying in case you make a typo right before the end :)
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.
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.
Have you played your own game?)
Sorry, can't approve a this state