有人可以帮我弄清楚我的程序出了什么问题,这对我来说很复杂。这是一个数字猜谜游戏,两个玩家可以玩。首先说哪个玩家先走,然后玩家必须输入他的号码 1 或 2,然后输入猜测或传球(玩家连续传球不能超过 3 次或两次)。它工作得非常好,除了每次玩家 1 开始时,它都会要求他连续猜测两次,然后工作正常,当玩家 2 开始时,它会像这样交替出现:


And this is my code It quite a lot of code:
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <malloc.h>
int main(void) { 
int playerNumber = 0;
int number = 0;
int playerInput = 0;    
int guess = 0;
char input;
char str[6] = {0};
int playerA = 1;
int playerB = 2;
int passA = 3;
int passB = 3;
int i = 1;
int playerTurn = 0;
int turn = 0;
 srand(time(NULL));
 playerNumber = 1 + rand() % 2; /* Random number is generated */
 srand(time(NULL));
 number = 0 + rand() % 100; /* Random number is generated */
  while(number != guess) {
   printf("\nIt's player's %d turn\n", playerNumber);
  printf("Player Number?\n");
  scanf("%d", &playerInput);
  while (playerNumber != playerInput)
   {
printf("You Have to wait your turn.\nPlayer number?\n");
  }
  if (playerA != playerNumber)
playerB = playerNumber;
if (i%2 == 1) {
    playerNumber = playerA;
    }
else {
    playerNumber = playerB;
    }
i = i+1;
    printf("Enter Your Guess, 0 - 100 or Pass: ");
scanf("%s", str);
if (strcmp(str, "pass") == 0){
    if (playerNumber == playerA){
        passB = passB -1;
        printf("Player 2 has %d more 'Pass' left!\n", passB);
        }   
    else{
        passA = passA -1;
        printf("Player 1 has %d more 'Pass' left!\n", passA);
        }
    }   
else {
    guess = atoi(str);
        if(guess < number) /* if the guess is lower, output: the guess is to low */
            printf("Your guess was to low.\n ");
        else if(guess > number) /* if the guess is higher, output: the guess is to high */
            printf("Your guess was to high.\n ");
        else /* is the guess is equial to the random number: Success!! */
            printf("Yes!! you got it!\n");
         }
 }
  return 0;
}