From d7a0fa451148e92fcb3be8eb22fbadb04ef3426b Mon Sep 17 00:00:00 2001 From: fdai7472 Date: Tue, 6 Feb 2024 12:45:25 +0100 Subject: [PATCH] refactoring: Konsolenausgaben etwas schoener geschrieben/formatiert --- src/main/c/Stefan/blackjack.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/c/Stefan/blackjack.c b/src/main/c/Stefan/blackjack.c index e7db0af..4935dc3 100644 --- a/src/main/c/Stefan/blackjack.c +++ b/src/main/c/Stefan/blackjack.c @@ -117,10 +117,10 @@ int playBJ(int bet, int balance){ userCardsTotal = calculateCardsTotal(userCardsArray, i); - printf("Your Cards Total : %d\n", userCardsTotal); + printf("Your Cards Total: %d\n\n", userCardsTotal); if(userCardsTotal > 21){ - printf("BUST\n"); + printf("YOU BUST\n\n"); free(userCardsArray); free(dealerCardsArray); @@ -129,7 +129,7 @@ int playBJ(int bet, int balance){ if(hit()){ userCardsArray[i] = getRandCard(i); - printf("new card: %d\n", userCardsArray[i]); + printf("Your new card: %d\n", userCardsArray[i]); } else{ break; } @@ -142,10 +142,10 @@ int playBJ(int bet, int balance){ if(dealerCardsTotal < 17){ dealerCardsArray[i] = getRandCard(i); - printf("Computer Card: %d\n", dealerCardsArray[i]); + printf("Dealer Card: %d\n", dealerCardsArray[i]); dealerCardsTotal = calculateCardsTotal(dealerCardsArray, i + 1); } - printf("Computer Cards Total: %d\n", dealerCardsTotal); + printf("Dealer Cards Total: %d\n", dealerCardsTotal); if(dealerCardsTotal >= 17 && dealerCardsTotal < 21){ if(calculateIfYouWon(userCardsTotal, dealerCardsTotal)){ @@ -155,7 +155,7 @@ int playBJ(int bet, int balance){ } if(dealerCardsTotal > 21){ - printf("COMPUTER BUST\n"); + printf("DEALER BUST\n\n"); winnings = calculateWinnings(false, bet); break; } @@ -178,7 +178,7 @@ int playBJ(int bet, int balance){ bool checkForBlackjack(int userCardArray[]){ if(userCardArray[0] + userCardArray[1] == 21){ - printf("BLACKJACK!\n"); + printf("BLACKJACK!\n\n"); return true; } return false; @@ -191,10 +191,10 @@ bool hit(){ scanf("%d", &answer); if(answer != 1){ - printf("stand.\n"); + printf("You stand.\n\n"); return false; } - printf("hit.\n"); + printf("You hit.\n\n"); return true; }