Browse Source

refactoring: konstanten Wert durch konstante Variable ersetzt

remotes/origin/stefan
fdai7472 11 months ago
parent
commit
aa64b5526b
  1. 10
      src/main/c/Stefan/blackjack.c
  2. 2
      src/main/c/Stefan/blackjack.h

10
src/main/c/Stefan/blackjack.c

@ -68,19 +68,19 @@ int userInputBJ(){
int getRandCard(int offset){ int getRandCard(int offset){
srand(time(NULL) + offset); srand(time(NULL) + offset);
int r = rand() % 13;
int r = rand() % ANZ_MOEGLICHE_KARTEN;
r++; r++;
// 11, 12, 13 = Bube, Dame, König haben den Wert 10
if(r > 10){ if(r > 10){
return 10; return 10;
} else if(r == 1){
}
// Ass (1) hat erstmal den Wert 11
else if(r == 1){
return 11; return 11;
} }
return r; return r;
} }

2
src/main/c/Stefan/blackjack.h

@ -3,6 +3,8 @@
#include <stdbool.h> #include <stdbool.h>
#define ANZ_MOEGLICHE_KARTEN 13
int blackjack(); int blackjack();
void welcomeMessageBJ(); void welcomeMessageBJ();
int getBalanceBJ(); int getBalanceBJ();

Loading…
Cancel
Save