Beispiel #1
0
 //Reset the game
 public void reset(string firstPlayerName = "", string secondPlayerName = "")
 {
     if (!string.IsNullOrWhiteSpace(firstPlayerName))
         first = new Player(firstPlayerName.Trim());
     else if (first == null)
         first = new Player("First player");
     if (!string.IsNullOrWhiteSpace(secondPlayerName))
         second = new Player(secondPlayerName.Trim());
     else if (second == null)
         second = new Player("Second player");
     cardDeck = new CardStock(first, second);
 }
Beispiel #2
0
 //Constructor:
 public Game(string firstPlayerName = "", string secondPlayerName = "")
 {
     first = new Player(string.IsNullOrWhiteSpace(firstPlayerName) ? "First player" : firstPlayerName.Trim());
     second = new Player(string.IsNullOrWhiteSpace(secondPlayerName) ? "Second player" : secondPlayerName.Trim());
     cardDeck = new CardStock(first, second);
 }