'Data structure for iterating between players
I am new to programming, so I started working on a small guessing game for n players In theory they are supposed to take turns trying to guess some String, I've successfully implemented that game for 1 player, but now I am struggling with how to implement iterating over all players. My code right now looks something like this:
while (!gameIsFinished) {
gameIsFinished = player1.takeTurn();
}
I guess I have to use some sort of Data structure to store all my players, but what would I choose in order to be able to iterate over them in a loop?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
