コード例 #1
0
 public void AddPlayer(Player _player)
 {
     Debug.Log($"Adding player");
     players.Add(_player);
     gameBoard.AddPlayer(_player);
     Debug.Log($"After adding player : " + players.Count);
 }
コード例 #2
0
        public int MakeGuess(Player player)
        {
            var guess = currentGuess++;

            GameBoard.AddPlayer(guess, player);

            return(guess);
        }
コード例 #3
0
        public int MakeGuess(Player player)
        {
            var guess = GameHelper.GetRandom();

            GameBoard.AddPlayer(guess, player);

            return(guess);
        }
コード例 #4
0
        public int MakeGuess(Player player)
        {
            while (!GameBoard.Contains(currentGuess))
            {
                currentGuess++;
                GameBoard.AddPlayer(currentGuess, player);
            }

            return(currentGuess);
        }
コード例 #5
0
        public int MakeGuess(Player player)
        {
            var range = Enumerable.Range(GameConstants.LowerLimit, GameConstants.UpperLimit).Where(i => !GameBoard.Contains(i));

            var index = new System.Random().Next(GameConstants.LowerLimit, GameConstants.UpperLimit + 1 - GameBoard.CountOfGuesses());

            var guess = range.ElementAt(index);

            GameBoard.AddPlayer(guess, player);

            return(guess);
        }