|
|
@ -17,6 +17,7 @@ void slotMachine(){ |
|
|
|
balance = subtractBetFromBalance(bet, balance); |
|
|
|
|
|
|
|
randomizeSymbols(symbols); |
|
|
|
spin(symbols, bet, balance); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
@ -88,6 +89,31 @@ void randomizeSymbols(Symbol symbols[]){ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int spin(Symbol symbols[], int bet, int balance){ |
|
|
|
|
|
|
|
int winnings = getWinnings(symbols, bet); |
|
|
|
|
|
|
|
return balance; |
|
|
|
} |
|
|
|
|
|
|
|
int getWinnings(Symbol symbols[], int bet){ |
|
|
|
|
|
|
|
int winnings = 0; |
|
|
|
|
|
|
|
// 0 | 1 | 2 |
|
|
|
// 3 | 4 | 5 |
|
|
|
// 6 | 7 | 8 |
|
|
|
|
|
|
|
// 3 gleiche Symbole in einer Reihe gewinnen, Gewinn berechnen |
|
|
|
for (int i = 0; i < ROWS; i++){ |
|
|
|
if (symbols[i * ROWS].letter == symbols[i * ROWS + 1].letter && symbols[i * ROWS].letter == symbols[i * ROWS + 2].letter) { |
|
|
|
winnings += bet * symbols[i * ROWS].value; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return winnings; |
|
|
|
} |
|
|
|
|
|
|
|
void welcomeMessage(){ |
|
|
|
printf("Herzlich Willkommen zur \n\n" |
|
|
|
" _ _ _ _ \n" |
|
|
|