Ancanus
[[email protected]]# _
- Reaction score
- 54
The game goes like this:
Every player gets another player as their target.
When a player is killed by his hunter, he's out of the game.
When a player is killed by someone else, he respawns.
When you kill your target, you get his target.
The issue I have is in the writing of the initial code. I had this in mind:
Add ALL PLAYERS to POOL
Pick every player in ALL PLAYERS and make their target a RANDOM PLAYER from POOL. Remove RANDOM PLAYER from POOL.
Adding a condition. RANDOM PLAYER must not equal PICKED PLAYER.
It seems to work well but... what if the last player only has himself as an option in the POOL? It would have to run itself again.
Is there efficient way to avoid falling into a loop? Thanks in advance.
Every player gets another player as their target.
When a player is killed by his hunter, he's out of the game.
When a player is killed by someone else, he respawns.
When you kill your target, you get his target.
The issue I have is in the writing of the initial code. I had this in mind:
Add ALL PLAYERS to POOL
Pick every player in ALL PLAYERS and make their target a RANDOM PLAYER from POOL. Remove RANDOM PLAYER from POOL.
Adding a condition. RANDOM PLAYER must not equal PICKED PLAYER.
It seems to work well but... what if the last player only has himself as an option in the POOL? It would have to run itself again.
Is there efficient way to avoid falling into a loop? Thanks in advance.