Initialer Commit mit einem ersten Durchstich über alle Layer

main
hummel 2025-04-01 18:01:48 +02:00
parent 92e03e3179
commit 93a2ef7342
7 changed files with 133 additions and 0 deletions

View File

@ -0,0 +1,28 @@
package de.th_mannheim.informatik.blackjack.domain;
public class Card {
private String suite;
private String value;
private int points;
public Card(String suite, String value) {
this.suite = suite;
this.value = value;
if ("BubeDameKönig".contains(value))
points = 10;
else if ("Ass".equals(value))
points = 11;
else
points = Integer.parseInt(value);
}
public int getPoints() {
return this.points;
}
public String toString() {
return suite + " " + value;
}
}

View File

@ -0,0 +1,10 @@
package de.th_mannheim.informatik.blackjack.domain;
public class CardDeck {
public Card getNextCard() {
return new Card("Pik", "Ass");
}
}

View File

@ -0,0 +1,5 @@
package de.th_mannheim.informatik.blackjack.domain;
public class Hand {
}

View File

@ -0,0 +1,17 @@
package de.th_mannheim.informatik.blackjack.facade;
import de.th_mannheim.informatik.blackjack.domain.Card;
import de.th_mannheim.informatik.blackjack.domain.CardDeck;
public class BlackjackGame {
private CardDeck deck;
public BlackjackGame() {
this.deck = new CardDeck();
}
public Card getNextCard() {
return deck.getNextCard();
}
}

View File

@ -0,0 +1,20 @@
package de.th_mannheim.informatik.blackjack.tui;
import de.th_mannheim.informatik.blackjack.facade.BlackjackGame;
public class GameMenu {
private BlackjackGame game;
public GameMenu(BlackjackGame game) {
this.game = game;
System.out.println("Willkommen beim THMA Blackjack!");
}
public void show() {
System.out.println("Ihre Karten sind: ");
System.out.println(game.getNextCard());
}
}

View File

@ -0,0 +1,35 @@
package de.th_mannheim.informatik.blackjack.tui;
import de.th_mannheim.informatik.blackjack.facade.BlackjackGame;
public class MainMenu {
private BlackjackGame game;
public MainMenu(BlackjackGame game) {
this.game = game;
System.out.println("Willkommen beim THMA Blackjack!");
}
public void show() {
while (true) {
System.out.println();
System.out.println("Ihre Eingabe:");
System.out.println("1 - Spiel beginnen");
System.out.println("9 - Spiel beenden");
System.out.println();
System.out.print("> ");
int input = TuiMain.kb.nextInt();
if (input == 1)
new GameMenu(game).show();
else if (input == 9)
break;
}
System.out.println();
System.out.println("Dankeschön und auf Wiedersehen, es war wirklich wunderschön.");
}
}

View File

@ -0,0 +1,18 @@
package de.th_mannheim.informatik.blackjack.tui;
import java.util.Scanner;
import de.th_mannheim.informatik.blackjack.facade.BlackjackGame;
public class TuiMain {
static Scanner kb = new Scanner(System.in);
public static void main(String[] args) {
MainMenu menu = new MainMenu(new BlackjackGame());
menu.show();
kb.close();
}
}