0

I ask you to help today because I can not seem to do something in my program.

It is a turn-based game, I manage this with:

player = turn % nbr_players;

this is the number of player we play for now

But I would add a condition if we want every person is a 2 turn each time. If someone would have an idea of ​​approach I am taking

thank you very much

1 Answers1

1

Assuming you are using C (see integer division), you can calculate (zero-based) player index:

player = (turn / turns_per_player) % nbr_players

where all variables are integer, and first turn is 0.

However, this code is a bit tricky. You may think of more formal and human-oriented alternatives of game rules implementation. But it depends on program purpose and scale.

Community
  • 1
  • 1
augur
  • 236
  • 1
  • 10