Added package structure

Sorted the classes in different packages
master
Victor Hans-Georg Waitz 2024-03-26 11:58:41 +01:00
parent ed299fbf16
commit 386aa44016
6 changed files with 28 additions and 8 deletions

View File

@ -1,3 +1,7 @@
package TUI;
import facade.BlackJackSpiel;
import java.util.Scanner;
public class Main {
@ -13,7 +17,6 @@ public class Main {
private static void gameLoop(){
BlackJackSpiel game = new BlackJackSpiel();
// Hand hand = game.getNeueHand();
while (true){
System.out.printf("%s Ihr Wert beträgt %d \n", game.handContent(), game.handValue());

View File

@ -1,3 +1,7 @@
package domain;
import domain.Karte;
import java.util.ArrayList;
import java.util.Objects;
@ -65,7 +69,7 @@ public class Hand {
@Override
public String toString() {
if (hand.isEmpty()){
return "Hand ist leer.";
return "domain.Hand ist leer.";
}
StringBuilder sb = new StringBuilder();

View File

@ -1,6 +1,8 @@
package domain;
public class Karte {
String farbe;
String wert;
public String farbe;
public String wert;
public Karte(String farbe, String wert) {
this.farbe = farbe;

View File

@ -1,9 +1,13 @@
package domain;
import domain.Karte;
import java.util.ArrayList;
import java.util.Random;
public class Kartenstapel {
private ArrayList<Karte> stapel = new ArrayList<>();
Kartenstapel(){
public Kartenstapel(){
stapel = generateNewStapel();
}

View File

@ -1,3 +1,8 @@
package facade;
import domain.Hand;
import domain.Kartenstapel;
public class BlackJackSpiel {
Kartenstapel ks;
private Hand hand;
@ -21,16 +26,16 @@ public class BlackJackSpiel {
// return this.hand;
}
void turn(){
public void turn(){
this.hand.drawCard(1);
// return this.hand;
}
String handContent(){
public String handContent(){
return hand.toString();
}
int handValue(){
public int handValue(){
return hand.getPunkte();
}
}

View File

@ -1,3 +1,5 @@
import domain.Karte;
import static org.junit.jupiter.api.Assertions.*;
class KarteTest {