Allow players to skip and end their turn
Quite simple, First we must add a new command:
private static string GetChoice() {
// Previous Commands
Console.WriteLine(" press 8 to skip your turn");
// Succeeding Commands
}
Then we must create a new condition within the HaveTurn method for the corresponding number:
private static string HaveTurn() {
// Some Stuff Was Here
else if (Choice == "8") {
}
// Some Stuff Is Here
}
Now as for actual logic, to end a players turn the while loop using Not(ValidChoice) must be broken. This can be done by just typing break or be setting the value of ValidChoice to true. Because the users input isn't an actual "ValidChoice", I feel it'd be more prudent to just break the loop and reach the end of the method; hence that's what I'll do.
private static string HaveTurn() {
// Some Stuff Was Here
else if (Choice == "8") {
Console.WriteLine("Your turn has been skipped");
break; // Break loop and end method
}
// Some Stuff Is Here
}
That's it, now if the player ever enters eight their move will be skipped.