|
@ -3,6 +3,23 @@ |
|
|
#include <stdlib.h> |
|
|
#include <stdlib.h> |
|
|
#include <time.h> |
|
|
#include <time.h> |
|
|
|
|
|
|
|
|
|
|
|
int generateRandom() { |
|
|
|
|
|
return rand() % 3; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int determineWinner(int spielerWahl, int computerWahl) { |
|
|
|
|
|
if ((spielerWahl == 0 && computerWahl == 2) || |
|
|
|
|
|
(spielerWahl == 1 && computerWahl == 0) || |
|
|
|
|
|
(spielerWahl == 2 && computerWahl == 1)) { |
|
|
|
|
|
return 1; // Spieler gewinnt |
|
|
|
|
|
} |
|
|
|
|
|
else if (spielerWahl == computerWahl) { |
|
|
|
|
|
return 0; // Unentschieden |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
return -1; // Computer gewinnt |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int run_scheresteinpapier() { |
|
|
int run_scheresteinpapier() { |
|
|