简体   繁体   中英

How to have a turn by turn management in C?

I want to make a game; say there are 50 turns and up to 4 players. How should the code manage the turn by turn?

For 2 player I think it is that:

    if (nbr_gamers == 2)
    {
         if ((turn % 2) == 0)
              player = 1;
         else
              player = 0;
    }

where the turn is the position of turn. Is that about right?

尝试这个 :

player = turn % nbr_gamers;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM