diff --git a/src/main/c/Stefan/blackjack.c b/src/main/c/Stefan/blackjack.c index 52cdba1..c12ad2b 100644 --- a/src/main/c/Stefan/blackjack.c +++ b/src/main/c/Stefan/blackjack.c @@ -98,6 +98,7 @@ int playBJ(int bet, int balance){ if(dealerCardsArray){ dealerCardsArray[0] = getRandCard(0); printf("computer rand card: %d\n", dealerCardsArray[0]); + generateCardAscii(dealerCardsArray[0]); // Array mit max 10 Karten anlegen int *userCardsArray = (int*) malloc(MAX_CARDS * sizeof(int)); @@ -106,8 +107,11 @@ int playBJ(int bet, int balance){ userCardsArray[0] = getRandCard(1); printf("user rand card: %d\n", userCardsArray[0]); + generateCardAscii(userCardsArray[0]); userCardsArray[1] = getRandCard(2); printf("user rand card: %d\n", userCardsArray[1]); + generateCardAscii(userCardsArray[1]); + if(checkForBlackjack(userCardsArray)){ winnings = calculateWinnings(true, bet); @@ -133,6 +137,7 @@ int playBJ(int bet, int balance){ if(hit()){ userCardsArray[i] = getRandCard(i); printf("Your new card: %d\n", userCardsArray[i]); + generateCardAscii(userCardsArray[i]); } else{ break; } @@ -146,6 +151,7 @@ int playBJ(int bet, int balance){ if(dealerCardsTotal < 17){ dealerCardsArray[i] = getRandCard(i); printf("Dealer Card: %d\n", dealerCardsArray[i]); + generateCardAscii(dealerCardsArray[i]); dealerCardsTotal = calculateCardsTotal(dealerCardsArray, i + 1); } printf("Dealer Cards Total: %d\n", dealerCardsTotal); diff --git a/src/test/c/Stefan/test_blackjack.c b/src/test/c/Stefan/test_blackjack.c index 675acac..203978c 100644 --- a/src/test/c/Stefan/test_blackjack.c +++ b/src/test/c/Stefan/test_blackjack.c @@ -199,3 +199,17 @@ void test_generate_char_for_card_2() { TEST_ASSERT_EQUAL_CHAR(expected_result, actual_result); } + +void test_generate_char_for_card_ace() { + + //arrange + int cardValue = 11; + char expected_result = 'A'; + + //act + char actual_result = generateCardAscii(cardValue); + + //assert + TEST_ASSERT_EQUAL_CHAR(expected_result, actual_result); + +}