コード例 #1
0
ファイル: Game.cs プロジェクト: azrielb/Homework
 //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);
 }
コード例 #2
0
ファイル: Game.cs プロジェクト: azrielb/Homework
 //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);
 }