This is a discussion on Determining who's turn it is within the Java Programming forums, part of the Software Development category; I'm just wondering what strategy you would use to determine what players turn it is in a game with ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| I'm just wondering what strategy you would use to determine what players turn it is in a game with more than two people. For two players I would just have a value increase after each player went then use the remainder operator to determine if the number is even or odd, if it is even player 1's turn, if its odd, player 2's turn...something like this Code: if(count % 2 == 0){ //player 1's turn } else { //player 2's turn } but I'm not sure what strategy i should use with, say a game with 4 players, any ideas? Edit: Other than manually coding, because there is infinity moves and I cant code that many lines, something like this is unreasonable imo if count = 0 //player 1 else if count = 1 //player 2 else if count = 2 //player 3 else if count = 3 //player 4 else if count = 4 //player 1 else if count = 5 //player 2 and so on indefinitely |
| Sponsored Links |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How do you turn off cookies for one page in your site in asp .net? | H2o | ASP and ASP.NET Programming | 1 | 07-20-2007 02:49 AM |
| Determining Midlet Launches | jeyaprakash.c | Mobile Software Development | 0 | 05-07-2007 08:31 AM |