public ChangeTrumpCardManager(IDeckState deckState, IGameState gameState, ITrickState trickState, IPlayerActionValidator playerActionValidator) : base(gameState, trickState) { this.deckState = deckState; this.gameState = gameState; this.playerActionValidator = playerActionValidator; }
public CloseDeck(ITrickState trickState, IGameState gameState, IAnnounceProvider announceProvider, IPlayerActionValidator playerActionValidator) : base(trickState) { this.gameState = gameState; this.announceProvider = announceProvider; this.playerActionValidator = playerActionValidator; }
public AnnounceMarriage(ITrickState trickState, IDeckState deckState, IAnnounceProvider announceProvider, IPlayerActionValidator playerActionValidator) : base(trickState) { this.deckState = deckState; this.announceProvider = announceProvider; this.playerActionValidator = playerActionValidator; }
public BotskoPlayerCommonLogic(IPlayerActionValidator playerActionValidator, ICollection<Card> cards, bool[,] playedCards) { this.playerActionValidator = playerActionValidator; this.cards = cards; //usedCards = new bool[4, 6]; usedCards = playedCards; }
public GameHand( PlayerPosition whoWillPlayFirst, IPlayer firstPlayer, IList <Card> firstPlayerCards, IPlayer secondPlayer, IList <Card> secondPlayerCards, BaseRoundState state, IDeck deck) { this.whoWillPlayFirst = whoWillPlayFirst; this.firstPlayer = firstPlayer; this.firstPlayerCards = firstPlayerCards; this.secondPlayer = secondPlayer; this.secondPlayerCards = secondPlayerCards; this.state = state; this.deck = deck; this.actionValidator = new PlayerActionValidator(); this.whoClosedTheGame = PlayerPosition.NoOne; }
public GameHand( PlayerPosition whoWillPlayFirst, IPlayer firstPlayer, IList<Card> firstPlayerCards, IPlayer secondPlayer, IList<Card> secondPlayerCards, BaseRoundState state, IDeck deck) { this.whoWillPlayFirst = whoWillPlayFirst; this.firstPlayer = firstPlayer; this.firstPlayerCards = firstPlayerCards; this.secondPlayer = secondPlayer; this.secondPlayerCards = secondPlayerCards; this.state = state; this.deck = deck; this.actionValidator = new PlayerActionValidator(); this.whoClosedTheGame = PlayerPosition.NoOne; }
public override PlayerAction GetTurn(PlayerTurnContext context, IPlayerActionValidator actionValidater) { // TODO: implement method return(null); }
public AnnounceProvider(IDeckState deckState, IPlayerActionValidator playerActionValidator) { this.deckState = deckState; this.playerActionValidator = playerActionValidator; }
public ChangeTrumpCard(ITrickState trickState, IDeckState deckState, IPlayerActionValidator playerActionValidator) : base(trickState) { this.deckState = deckState; this.playerActionValidator = playerActionValidator; }
public abstract PlayerAction GetTurn( PlayerTurnContext context, IPlayerActionValidator actionValidater);
public override PlayerAction GetTurn( PlayerTurnContext context, IPlayerActionValidator actionValidator) { PrintGameInfo(context); while (true) { PlayerAction playerAction = null; Console.SetCursorPosition(0, this.row + 1); Console.Write(new string(' ', 79)); Console.SetCursorPosition(0, this.row + 1); Console.Write("Turn? [1-{0}]=Card{1}", this.cards.Count, context.AmITheFirstPlayer ? "; [T]=Change trump; [C]=Close: " : ": "); var userActionAsString = Console.ReadLine(); if (string.IsNullOrWhiteSpace(userActionAsString)) { Console.WriteLine("Empty turn! "); continue; } if (userActionAsString[0] >= '1' && userActionAsString[0] <= '6') { var cardIndex = int.Parse(userActionAsString[0].ToString()) - 1; if (cardIndex >= this.cards.Count) { Console.WriteLine("Invalid card! "); continue; } var card = this.cards[cardIndex]; var possibleAnnounce = Announce.None; if (context.AmITheFirstPlayer) { possibleAnnounce = this.PossibleAnnounce(card, context.TrumpCard); if (possibleAnnounce != Announce.None) { while (true) { Console.SetCursorPosition(0, this.row + 2); Console.Write("Announce {0} [Y]/[N]? ", possibleAnnounce.ToString()); var userInput = Console.ReadLine(); if (string.IsNullOrWhiteSpace(userInput)) { Console.WriteLine("Please enter [Y] or [N] "); continue; } if (userInput[0] == 'N') { possibleAnnounce = Announce.None; } else if (userInput[0] == 'Y') { break; } else { Console.WriteLine("Please enter [Y] or [N] "); continue; } } } } playerAction = new PlayerAction( PlayerActionType.PlayCard, card, possibleAnnounce); } else if (userActionAsString[0] == 'T') { playerAction = new PlayerAction( PlayerActionType.ChangeTrump, null, Announce.None); } else if (userActionAsString[0] == 'C') { playerAction = new PlayerAction( PlayerActionType.CloseGame, null, Announce.None); } else { Console.WriteLine("Invalid turn! "); continue; } if (actionValidator.IsValid(playerAction, context, this.cards)) { if (playerAction.Type == PlayerActionType.PlayCard) { this.cards.Remove(playerAction.Card); } if (playerAction.Type == PlayerActionType.ChangeTrump) { this.cards.Remove(new Card(context.TrumpCard.Suit, CardType.Nine)); } this.PrintGameInfo(context); return(playerAction); } else { Console.WriteLine("Invalid action! "); continue; } } }
public override PlayerAction GetTurn( PlayerTurnContext context, IPlayerActionValidator actionValidator) { PrintGameInfo(context); while (true) { PlayerAction playerAction = null; Console.SetCursorPosition(0, this.row + 1); Console.Write(new string(' ', 79)); Console.SetCursorPosition(0, this.row + 1); Console.Write("Turn? [1-{0}]=Card{1}", this.cards.Count, context.AmITheFirstPlayer ? "; [T]=Change trump; [C]=Close: " : ": "); var userActionAsString = Console.ReadLine(); if (string.IsNullOrWhiteSpace(userActionAsString)) { Console.WriteLine("Empty turn! "); continue; } if (userActionAsString[0] >= '1' && userActionAsString[0] <= '6') { var cardIndex = int.Parse(userActionAsString[0].ToString()) - 1; if (cardIndex >= this.cards.Count) { Console.WriteLine("Invalid card! "); continue; } var card = this.cards[cardIndex]; var possibleAnnounce = Announce.None; if (context.AmITheFirstPlayer) { possibleAnnounce = this.PossibleAnnounce(card, context.TrumpCard); if (possibleAnnounce != Announce.None) { while (true) { Console.SetCursorPosition(0, this.row + 2); Console.Write("Announce {0} [Y]/[N]? ", possibleAnnounce.ToString()); var userInput = Console.ReadLine(); if (string.IsNullOrWhiteSpace(userInput)) { Console.WriteLine("Please enter [Y] or [N] "); continue; } if (userInput[0] == 'N') { possibleAnnounce = Announce.None; } else if (userInput[0] == 'Y') { break; } else { Console.WriteLine("Please enter [Y] or [N] "); continue; } } } } playerAction = new PlayerAction( PlayerActionType.PlayCard, card, possibleAnnounce); } else if (userActionAsString[0] == 'T') { playerAction = new PlayerAction( PlayerActionType.ChangeTrump, null, Announce.None); } else if (userActionAsString[0] == 'C') { playerAction = new PlayerAction( PlayerActionType.CloseGame, null, Announce.None); } else { Console.WriteLine("Invalid turn! "); continue; } if (actionValidator.IsValid(playerAction, context, this.cards)) { if (playerAction.Type == PlayerActionType.PlayCard) { this.cards.Remove(playerAction.Card); } if (playerAction.Type == PlayerActionType.ChangeTrump) { this.cards.Remove(new Card(context.TrumpCard.Suit, CardType.Nine)); } this.PrintGameInfo(context); return playerAction; } else { Console.WriteLine("Invalid action! "); continue; } } }
public BotskoPlayerFirstTurnLogic(IPlayerActionValidator playerActionValidator, ICollection<Card> cards, bool[,] playedCards) : base(playerActionValidator, cards, playedCards) { }
public override PlayerAction GetTurn(PlayerTurnContext context, IPlayerActionValidator actionValidater) { // TODO: implement method return null; }