Erstes DTO eingefügt
parent
93a2ef7342
commit
7e016fafdf
|
@ -1,7 +1,7 @@
|
||||||
package de.th_mannheim.informatik.blackjack.facade;
|
package de.th_mannheim.informatik.blackjack.facade;
|
||||||
|
|
||||||
import de.th_mannheim.informatik.blackjack.domain.Card;
|
|
||||||
import de.th_mannheim.informatik.blackjack.domain.CardDeck;
|
import de.th_mannheim.informatik.blackjack.domain.CardDeck;
|
||||||
|
import de.th_mannheim.informatik.blackjack.facade.dtos.CardDTO;
|
||||||
|
|
||||||
public class BlackjackGame {
|
public class BlackjackGame {
|
||||||
private CardDeck deck;
|
private CardDeck deck;
|
||||||
|
@ -10,8 +10,8 @@ public class BlackjackGame {
|
||||||
this.deck = new CardDeck();
|
this.deck = new CardDeck();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Card getNextCard() {
|
public CardDTO getNextCard() {
|
||||||
return deck.getNextCard();
|
return new CardDTO(deck.getNextCard());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
package de.th_mannheim.informatik.blackjack.facade.dtos;
|
||||||
|
|
||||||
|
import de.th_mannheim.informatik.blackjack.domain.Card;
|
||||||
|
|
||||||
|
public record CardDTO(String name, int points) {
|
||||||
|
public CardDTO(Card card) {
|
||||||
|
this(card.toString(), card.getPoints());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,11 +7,11 @@ public class GameMenu {
|
||||||
|
|
||||||
public GameMenu(BlackjackGame game) {
|
public GameMenu(BlackjackGame game) {
|
||||||
this.game = game;
|
this.game = game;
|
||||||
|
|
||||||
System.out.println("Willkommen beim THMA Blackjack!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show() {
|
public void show() {
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
System.out.println("Ihre Karten sind: ");
|
System.out.println("Ihre Karten sind: ");
|
||||||
|
|
||||||
System.out.println(game.getNextCard());
|
System.out.println(game.getNextCard());
|
||||||
|
|
Loading…
Reference in New Issue