-
Notifications
You must be signed in to change notification settings - Fork 0
Tic Tac Toe #3
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
base: master
Are you sure you want to change the base?
Tic Tac Toe #3
Conversation
Tic-tac-toe/.idea/compiler.xml
Outdated
| @@ -0,0 +1,9 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
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.
В чем смысл хранения .idea в репозитории для гредл проекта? Пока -2
| * Implements logic of game with AI. | ||
| */ | ||
| public class AIBoard extends AbstractBoard { | ||
| private AI AI; |
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.
Название нестатичного поля заглавными буквами, -1
Поле должно быть final, -0.5
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.
@dzharkov следует начинать с маленькой даже если это аббревиатура?
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.
Да, или как вариант не давать имена, состоящие ровно из аббревиатуры
| int turn = ThreadLocalRandom.current().nextInt(0, freeCellsNumber); | ||
| for (int i = 0; i < board.length; i++) { | ||
| for (int j = 0; j < board.length; j++) { | ||
| if (board[i][j].equals(" ") && turn-- == 0) { |
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.
Предлагаю использовать enum вместо строковых констант, -0.5
|
|
||
| @Test | ||
| public void testEasyLevelConstructor() { | ||
| new AIBoard(10, AILevel.EASY); |
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.
@dzharkov в качестве первого минимального теста нам рекомендуют проверять, что конструктор не падает.
| singlePlayerButton.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); | ||
| singlePlayerButton.setOnAction(value -> { | ||
| switch (AILevelComboBox.getValue()) { | ||
| case "Medium": |
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.
В таких случаях правильней использовать static final поля (константы), -0.5
|
|
||
| @Test | ||
| public void testMakeTurnMediumAIVerticalWin() throws IllegalAccessException { | ||
| Board board = new AIBoard(3, AILevel.MEDIUM); |
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.
Очень много кода в тестах дублируется.
Предлагаю заэкстрактить общие части в методы. Пока -0.5
dzharkov
left a comment
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.
Ок, 10
No description provided.