public Game(string player1Name, string player2Name)
 {
     Player1 = new Player();
     Player1.Name = player1Name;
     Player2 = new Player();
     Player2.Name = player2Name;
 }
 public Game(string player1Name, string player2Name)
 {
     this.player1 = new Player(player1Name);
     this.player2 = new Player(player2Name);
     this.player1.Name = player1Name;
     this.player2.Name = player2Name;
 }
Beispiel #3
0
 public Game(string playerName, Random random)
 {
     // Creating and setting the private objects.
     _player = new Player();
     _player.Name = playerName;
     PlayerName = _player.Name;
     _random = random;
 }
 private void PlayRound(Player player)
 {
     for(int i = 0; i < 3; i++)
     {
         Dart dart = new Dart(Random);
         dart.Throw();
         Score.CalculateScore(player, dart);
     }
 }
        public void performGame()
        {
            //Two players will take turns throwing three darts per turn.
            Player player1 = new Player();
            Player player2 = new Player();

            while (player1.Score < 300 && player2.Score < 300)
            {
                player1.Score += takeTurn();
                player2.Score += takeTurn();
            }

            this.Player1Score = player1.Score;
            this.Player2Score = player2.Score;
        }
 public static void CalculateScore(Player player, Dart dart)
 {
     player.Score += CalculateScore(dart.Score, dart);
 }