Esempio n. 1
0
        private Turn.Turn GetNextTurn()
        {
            if (CurrentTurn == null)
            {
                CurrentTurn = new Turn.Turn(Players.First());
                _setAsideCards.Add(RemoveTopCard());
                foreach (var player in Players)
                {
                    var drawn   = RemoveTopCard();
                    var newHand = new Hand.Hand(drawn);
                    _hands[player.Id] = newHand;
                }
            }
            else
            {
                if (_remainingPlayers.Count <= 1 ||
                    _drawCards.Count <= 0)
                {
                    return(null);
                }
                var nextPlayerIndex = Players.ToList().IndexOf(CurrentTurn.CurrentPlayer) + 1;
                var nextPlayer      = Players.Concat(Players).Skip(nextPlayerIndex).First();
                var drawn           = Draw();
                var newHand         = _hands[nextPlayer.Id].Append(drawn);
                _hands[nextPlayer.Id] = newHand;
                CurrentTurn           = new Turn.Turn(nextPlayer);
            }

            return(CurrentTurn);
        }
Esempio n. 2
0
 public PlayContext(Action <Guid> addPlayerProtection,
                    Action <Guid> eliminatePlayer, Turn.Turn currentTurn,
                    Action <Guid, Guid> tradeHands,
                    Func <Guid, CardValue> revealHand,
                    Action <Guid> discardAndDraw,
                    Guid?targetPlayerId,
                    CardValue?guessedCardvalue)
 {
     _addPlayerProtection = addPlayerProtection;
     _eliminatePlayer     = eliminatePlayer;
     CurrentTurn          = currentTurn;
     TargetPlayerId       = targetPlayerId;
     GuessedCardvalue     = guessedCardvalue;
     _tradeHands          = tradeHands;
     _revealHand          = revealHand;
     _discardAndDraw      = discardAndDraw;
 }
Esempio n. 3
0
 public void ResponseToActionRequest(string actionTimer)
 {
     Turn.Turn turn = makeTurn();
     Console.WriteLine(turn.ToString());
 }
Esempio n. 4
0
 public DrawContext(Turn.Turn currentTurn,
                    Func <Hand.Hand> getCurrentPlayerHand)
 {
     CurrentTurn           = currentTurn;
     _getCurrentPlayerHand = getCurrentPlayerHand;
 }