Beispiel #1
0
        public Card GetMove(GameState state)
        {
            PrintPlayerState(state.Players.ToList());
            PrintCurrentTrick(state.CurrentTrick);
            PrintOwnCards(state);
            var validCards   = state.Players[state.Turn.PlayerIndex].Hand as KnownHand;
            var enteredIndex = ConsoleUi.PromptInt("Which card to play? Enter #: ", 1, validCards.NumberOfCards);

            return(validCards[enteredIndex - 1]);
        }
Beispiel #2
0
        public int GetGuess(GameState state)
        {
            PrintOwnCards(state);
            var otherPlayerIndices = Enumerable.Range(state.Turn.PlayerIndex + 1, state.Players.Count - 1)
                                     .Select(index => index % state.Players.Count);

            foreach (var otherPlayerIndex in otherPlayerIndices)
            {
                var guess = state.Players[otherPlayerIndex].Guess;
                if (guess.HasValue)
                {
                    System.Console.WriteLine($"P{otherPlayerIndex + 1}: {guess}");
                }
            }
            return(ConsoleUi.PromptInt("Enter your guess: ", 0, 100));
        }