I want to make a simple game of 3 players, each player moves in a block depending of the random function from 1 to 6 blocks each time, when first player has been moved the second player start and then then the third player. To do that I increase the index of an array rach time a player finish its move.
My problem is that the indexer seems no to been increased, and it stacks in the player 1 even if I increase it. I have exactly the same code in C# and it works well!
Here is the code in C++.
int main ()
{
        string namesofplayers[] = {"one","two","three"};
        int movementofplayers[] = {0,0,0}; // start position of players is 
        int gamesize = 32; //32 blocks-steps of game
        int random;
        int y = 0;
        a:
        y++;
        if (y >= 3) 
        {
            y = 0;
        }
        cout << "it's" << namesofplayers[y] << "turn to play";
        int R = (rand() % 6 + 1);
        cout << "player " << namesofplayers[y] << " moves to block" << R << endl;
        movementofplayers[y] += random;
        cout << movementofplayers[y];
        if (movementofplayers[y] < gamesize)
        {
             goto a;
        }
        else 
        { 
              cout << "Player " << namesofplayers[y] << " wins the game" << endl;
        }
}
 
     
     
    