samedi 27 octobre 2018

C# - trying to create a console board game but can't get game to iterate through loop indefinitely

So i've pretty much got up to 6 objects which are players, and they move depending on a dice roll. The game works although i'm struggling to get the game to iterate through each players turn while the game isn't over.

so far i'm pretty much saying:

foreach (player in players)
{
     while (player.finish == false)
     {
          play_turn();
     }
}

But with a while loop it will stay on player 1's turn until they finish the game, then go to player 2. Whereas if I use an if instead of a while it will only iterate for as many players are in the game...

Maybe i've been overthinking it, any help would be appreciated

Aucun commentaire:

Enregistrer un commentaire