Skip to content

Task_1_1_2#3

Open
Qangan wants to merge 3 commits into
masterfrom
task-1-1-2
Open

Task_1_1_2#3
Qangan wants to merge 3 commits into
masterfrom
task-1-1-2

Conversation

@Qangan
Copy link
Copy Markdown
Owner

@Qangan Qangan commented Sep 16, 2025

Сделал все игровые сущности кроме дилера и написал немного тестов

@github-actions
Copy link
Copy Markdown

There is no coverage information present for the Files changed

Total Project Coverage 76.13%

@Qangan
Copy link
Copy Markdown
Owner Author

Qangan commented Sep 16, 2025

There is no coverage information present for the Files changed

Total Project Coverage 76.13% ❌

Не совсем уверен что он берет Task_1_1_2 и вообще мне кажется оно сломалось

@github-actions
Copy link
Copy Markdown

There is no coverage information present for the Files changed

Total Project Coverage 76.13%

@github-actions
Copy link
Copy Markdown

There is no coverage information present for the Files changed

Total Project Coverage 71.6%

Copy link
Copy Markdown
Collaborator

@Sharapov-Maksim Sharapov-Maksim left a comment

Choose a reason for hiding this comment

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

Мягкий дедлайн зачтён

Comment on lines +1 to +2
package qangan.blackjack;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

package не соответствует действительности

Comment on lines +1 to +2
package qangan.blackjack;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Названия пакетов лучше строго lowercase писать (это про CardRelated и PlayerRelated)

Comment on lines +11 to +12
/** Deck class constructor. */
public Deck() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Для тестирования вам пригодится ещё возможность задавать фиксированную наперёд заданную колоду


import org.junit.jupiter.api.Test;

public class BlackjackTest {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Тесты лучше разбить на отдельные классы, в соответствии с тестируемыми классами

Comment on lines +81 to +97
void aceIncrease() {
boolean validated = false;
for (int tries = 0; tries < 200; tries++) {
Deck deck = new Deck();
deck.shuffle();
Hand hand = new Hand();
int before = hand.getScore();
hand.addCard(deck);
Card last = hand.getCard(hand.getCardCount() - 1);
if (last.getRank() == Rank.ACE && before <= 10) {
assertEquals(before + 11, hand.getScore());
validated = true;
break;
}
}
assertTrue(validated);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Какой-то сложный тест. Он упростится (и станет воспроизводимым), если сделать предопределённую колоду.

Comment on lines +19 to +20
/** Draw card. */
public void addCard(Deck deck) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Когда будете доделывать, подумайте, насколько вам удобно здесь передавать именно колоду. Может будет удобнее передавать только карту. Или в качестве возвращаемого значения вернуть взятую карту. Ведь "игре" тоже полезно знать, какую карту получает игрок (для логирования).

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.

2 participants