From 34bb0cb4206a9f8f9c0c3f612a65bffc1cf8bc96 Mon Sep 17 00:00:00 2001 From: Celine Khazarian Date: Fri, 9 Feb 2024 00:02:39 +0100 Subject: [PATCH] refactoring: computer zu Player2 --- src/main/c/SchereSteinPapier.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/c/SchereSteinPapier.c b/src/main/c/SchereSteinPapier.c index 7fe7346..8ff5849 100644 --- a/src/main/c/SchereSteinPapier.c +++ b/src/main/c/SchereSteinPapier.c @@ -3,24 +3,24 @@ #include #include -int game(char Player1, char computer) +int game(char Player1, char Player2) { - if (Player1 == '1' && computer == '1') + if (Player1 == '1' && Player2 == '1') return -1; - if (Player1 == '2' && computer == '2') + if (Player1 == '2' && Player2 == '2') return -1; - if (Player1 == '3' && computer == '3') + if (Player1 == '3' && Player2 == '3') return -1; - if (Player1 == '2' && computer == '3') + if (Player1 == '2' && Player2 == '3') 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; - else if (Player1 == '1' && computer == '2') + else if (Player1 == '1' && Player2 == '2') return 0; - if (Player1 == '3' && computer == '1') + if (Player1 == '3' && Player2 == '1') return 0; - else if (Player1 == '1' && computer == '3') + else if (Player1 == '1' && Player2 == '3') return 1; }