Browse Source

refactoring: computer zu Player2

main
Celine Khazarian 11 months ago
parent
commit
34bb0cb420
  1. 20
      src/main/c/SchereSteinPapier.c

20
src/main/c/SchereSteinPapier.c

@ -3,24 +3,24 @@
#include <time.h> #include <time.h>
#include <math.h> #include <math.h>
int game(char Player1, char computer)
int game(char Player1, char Player2)
{ {
if (Player1 == '1' && computer == '1')
if (Player1 == '1' && Player2 == '1')
return -1; return -1;
if (Player1 == '2' && computer == '2')
if (Player1 == '2' && Player2 == '2')
return -1; return -1;
if (Player1 == '3' && computer == '3')
if (Player1 == '3' && Player2 == '3')
return -1; return -1;
if (Player1 == '2' && computer == '3')
if (Player1 == '2' && Player2 == '3')
return 0; return 0;
else if (Player1 == '3' && computer == '2') return 1;
if (Player1 == '2' && computer == '1')
else if (Player1 == '3' && Player2 == '2') return 1;
if (Player1 == '2' && Player2 == '1')
return 1; return 1;
else if (Player1 == '1' && computer == '2')
else if (Player1 == '1' && Player2 == '2')
return 0; return 0;
if (Player1 == '3' && computer == '1')
if (Player1 == '3' && Player2 == '1')
return 0; return 0;
else if (Player1 == '1' && computer == '3')
else if (Player1 == '1' && Player2 == '3')
return 1; return 1;
} }

Loading…
Cancel
Save