bug hunt anfang

main
Luc Vonnemann 2024-03-25 20:30:23 +01:00
parent 8c0e89011c
commit ebea258044
3 changed files with 9 additions and 7 deletions

View File

@ -7,13 +7,13 @@ public class CardStack {
private int[] random_place = new int[52]; private int[] random_place = new int[52];
private final String[] card_values = {"Ass", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Bube", "Dame", "King"}; private final String[] card_values = {"Ass", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Bube", "Dame", "King"};
private final String[] card_colors = {"Piek", "Kreuz", "Karo", "Herz"}; private final String[] card_colors = {"Piek", "Kreuz", "Karo", "Herz"};
private int card_draw_counter = 0; public int card_draw_counter = 0;
public CardStack() { public CardStack() {
int next_place; int next_place;
for (int i = 1; i <= 13; i++) { for (int i = 0; i < 13; i++) {
for (int j = 1; j <= 4; j++) { for (int j = 0; j < 4; j++) {
next_place = get_place(); next_place = get_place();
shuffled_cards[next_place] = get_card(card_values[i], card_colors[j]); shuffled_cards[next_place] = get_card(card_values[i], card_colors[j]);
} }

View File

@ -14,8 +14,9 @@ public class Hand {
public String toString() { public String toString() {
String return_message = "Die Karten sind: "; String return_message = "Die Karten sind: ";
for (Card card : current_hand) { for (int i = 0; i < cs.card_draw_counter; i++) {
System.out.print(card.card_value + " , " + card.color + " , "); Card card = current_hand[i];
System.out.print(card.card_value + " in " + card.color + " , ");
} }
System.out.println("Insgesamt sind dies " + Integer.toString(get_points()) + " Punkte"); System.out.println("Insgesamt sind dies " + Integer.toString(get_points()) + " Punkte");
@ -25,7 +26,8 @@ public class Hand {
public int get_points() { public int get_points() {
int sum = 0; int sum = 0;
for (Card card : current_hand) { for (int i = 0; i < cs.card_draw_counter; i++) {
Card card = current_hand[i];
sum += card.get_points(card); sum += card.get_points(card);
} }

View File

@ -11,7 +11,7 @@ public class TUI {
} }
//TODO Ass und Exception + JUnit //TODO Ass und Exception + JUnit + new_hand
public void game_loop() { public void game_loop() {
System.out.println(bs); System.out.println(bs);