Skip to content

Conversation

@DmKazakov
Copy link
Owner

No description provided.

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>

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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Название нестатичного поля заглавными буквами, -1
Поле должно быть final, -0.5

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dzharkov следует начинать с маленькой даже если это аббревиатура?

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) {

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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Что проверяет этот тест?

Copy link
Owner Author

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":

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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Очень много кода в тестах дублируется.
Предлагаю заэкстрактить общие части в методы. Пока -0.5

Copy link

@dzharkov dzharkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ок, 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants