I am programming a software which generates random (or close too) numbers. I am adding a multi-player feature to it. I ask the user how many players there are (variable P'), and how many turns in a row each player gets (variable e, for every). I also know the total amount of global turns that have taken place in the game (variable T).(adsbygoogle = window.adsbygoogle || []).push({});

Each player gets there turn via least to greatest. Player "1" goes first, and gets to play for "e" amount of times. Each time any player takes a turn, variable "T" increases by +1. How do I know who's turn is (variable p) given the values of P', T, and e? I make algerbra equations all the time, but I have been struggling with this for days and I just cant seem to get it. I hope somebody here is good enough at mathematics to derive an equation from this. I know you have to use the Fix() function in it, and you probably have to divide T by P' somewhere. But I do not have the equation I will draw a chart of how the game will fold out.

P' = 2 (it's a two player game) e=1 (Each player gets to play one time in a row)

remember...T = Total turns in the game p = Who's turn it should be

T p

-------

1 1

2 2

3 1

4 2

5 1

6 2

7 1

P' = 2 (it's a two player game) e=2 (Each player gets to play two times in a row)

remember...T = Total turns in the game p = Who's turn it should be

T p

-------

1 1

2 1

3 2

4 2

5 1

6 1

7 2

P' = 2 (how many players there are) e=3 (Each player gets to play three times in a row)

remember...T = Total turns in the game p = Who's turn it should be

T p

-------

1 1

2 1

3 1

4 2

5 2

6 2

7 1

again, I need to know p with only knowing "P'", "T", and "e". If I can draw a diagram of it on paper, I know it can be done mathematically

Thank you very much

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# I have to derive my own equation, I need help

**Physics Forums | Science Articles, Homework Help, Discussion**