|
|
@ -2,6 +2,7 @@ |
|
|
|
#include <stdio.h> |
|
|
|
#include <stdlib.h> |
|
|
|
#include <time.h> |
|
|
|
#include <string.h> |
|
|
|
|
|
|
|
void slotMachine(){ |
|
|
|
|
|
|
@ -86,9 +87,10 @@ void randomizeSymbols(char symbols[]){ |
|
|
|
|
|
|
|
int spin(char symbols[], int bet, int balance){ |
|
|
|
|
|
|
|
showResult(symbols); |
|
|
|
|
|
|
|
int winnings = getWinnings(symbols, bet); |
|
|
|
|
|
|
|
showResult(symbols, winnings); |
|
|
|
|
|
|
|
balance += winnings; |
|
|
|
printf("Aktuelles Guthaben: %d\n-------------------------\n", balance); |
|
|
|
return balance; |
|
|
@ -125,12 +127,30 @@ int getWinnings(char symbols[], int bet){ |
|
|
|
return winnings; |
|
|
|
} |
|
|
|
|
|
|
|
void showResult(char symbols[]){ |
|
|
|
printf("\n"); |
|
|
|
void showResult(char symbols[], int winnings){ |
|
|
|
|
|
|
|
for (int i = 0; i < ROWS; i++){ |
|
|
|
printf(" %c | %c | %c\n", symbols[i * ROWS], symbols[i * ROWS + 1], symbols[i * ROWS + 2]); |
|
|
|
char winnerMessage[] = {""}; |
|
|
|
|
|
|
|
if(winnings > 0){ |
|
|
|
strcpy(winnerMessage, " WINNER "); |
|
|
|
} else { |
|
|
|
strcpy(winnerMessage, " LOSER "); |
|
|
|
} |
|
|
|
|
|
|
|
printf("\n" |
|
|
|
" .-------.\n" |
|
|
|
" {-%s-} \n" |
|
|
|
" .=============.\n" |
|
|
|
" | | __\n" |
|
|
|
" | [%c] [%c] [%c] |( )\n" |
|
|
|
" | [%c] [%c] [%c] | ||\n" |
|
|
|
" | [%c] [%c] [%c] | ||\n" |
|
|
|
" | |_||\n" |
|
|
|
" | xxx ::::::: |--'\n" |
|
|
|
" | ooo ::::::: |\n" |
|
|
|
" | $$$ ::::::: |\n" |
|
|
|
" | __ |\n" |
|
|
|
" |_____/__\\____|\n\n", winnerMessage, symbols[0], symbols[1], symbols[2], symbols[3], symbols[4], symbols[5], symbols[6], symbols[7], symbols[8]); |
|
|
|
} |
|
|
|
|
|
|
|
void welcomeMessage(){ |
|
|
|