From fd5102f4e72a228d5bc58d8a2b9171e34d627e57 Mon Sep 17 00:00:00 2001 From: Celine Khazarian Date: Fri, 9 Feb 2024 00:01:28 +0100 Subject: [PATCH] refactoring: you zu Player1 --- src/main/c/SchereSteinPapier.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/c/SchereSteinPapier.c b/src/main/c/SchereSteinPapier.c index a97bc1e..7fe7346 100644 --- a/src/main/c/SchereSteinPapier.c +++ b/src/main/c/SchereSteinPapier.c @@ -3,24 +3,24 @@ #include #include -int game(char you, char computer) +int game(char Player1, char computer) { - if (you == '1' && computer == '1') + if (Player1 == '1' && computer == '1') return -1; - if (you == '2' && computer == '2') + if (Player1 == '2' && computer == '2') return -1; - if (you == '3' && computer == '3') + if (Player1 == '3' && computer == '3') return -1; - if (you == '2' && computer == '3') + if (Player1 == '2' && computer == '3') return 0; - else if (you == '3' && computer == '2') return 1; - if (you == '2' && computer == '1') + else if (Player1 == '3' && computer == '2') return 1; + if (Player1 == '2' && computer == '1') return 1; - else if (you == '1' && computer == '2') + else if (Player1 == '1' && computer == '2') return 0; - if (you == '3' && computer == '1') + if (Player1 == '3' && computer == '1') return 0; - else if (you == '1' && computer == '3') + else if (Player1 == '1' && computer == '3') return 1; } @@ -32,7 +32,7 @@ int PVC() { printf("\t\t\t\tName Spieler/in: "); scanf("%s", Spieler); while (ende[0] == 'W' || ende[0] == 'w') { - char you = 'Y', computer, Ergebnis; + char Player1 = 'Y', computer, Ergebnis; srand(time(NULL)); n = rand() % 100; if (n < 33) { @@ -43,12 +43,12 @@ int PVC() { } else { computer = '1'; - } while (you != '3' && you != '1' && you != '2') { + } while (Player1 != '3' && Player1 != '1' && Player1 != '2') { printf("\n\n\n\n\t\t\t\tWaehlen Sie 1 fuer Schere, 2 fuer Stein oder 3 fuer Papier: \n\t\t\t\t\t\t\t"); - scanf(" %c", &you); + scanf(" %c", &Player1); } - Ergebnis = game(you, computer); + Ergebnis = game(Player1, computer); if (Ergebnis == -1) { printf("\n\n\t\t\t\tUnentschieden!\n\n"); @@ -65,7 +65,7 @@ int PVC() { } - printf("\t\t\t\tDu hast ausgesucht : %c und Computer hat ausgesucht : %c\n\n", you, computer); + printf("\t\t\t\tDu hast ausgesucht : %c und Computer hat ausgesucht : %c\n\n", Player1, computer); printf("\t\t\t\tPunktestand: %s - %d, Computer - %d\n\n", Spieler, Punkte1, Punkte2); printf("\t\t\t\tMoechten Sie weiter spielen oder beenden? (Weiter/Ende)\n\t\t\t\t"); scanf("%s", ende);