Initialer Commit mit einem ersten Durchstich über alle Layer
parent
92e03e3179
commit
93a2ef7342
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package de.th_mannheim.informatik.blackjack.domain;
|
||||
|
||||
public class CardDeck {
|
||||
|
||||
public Card getNextCard() {
|
||||
return new Card("Pik", "Ass");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package de.th_mannheim.informatik.blackjack.domain;
|
||||
|
||||
public class Hand {
|
||||
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
|
@ -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.");
|
||||
}
|
||||
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue