예제 #1
0
        public LittleWackosStrategy() : base(StrategyName)
        {
            var deck = new ItalianDeckFactory().CreateDeck();

            while (deck.Count > 0)
            {
                _unplayedCards.Add(deck.Pop());
            }
        }
예제 #2
0
파일: Watcher.cs 프로젝트: mrtotov/Briscola
        public Watcher()
        {
            var deck = new ItalianDeckFactory().CreateDeck();

            while (deck.Count > 0)
            {
                _unplayedCards.Add(deck.Pop());
            }
        }
예제 #3
0
        public static GameState CreateHand(IStrategy sut, Card briscola, Card[] dish, Card[] handCards, int turn = 5)
        {
            var deck = new ItalianDeckFactory().CreateDeck();

            turn = turn != 5 ? turn : new Random().Next(0, 4);
            var players = new List <IPlayer>();

            for (int i = 0; i < 4; i++)
            {
                players.Add((4 - turn + i) % 4 != dish.Length
            ? new Player(new RandomStrategy(), "p" + i + 1)
            : new Player(sut, "p" + i + 1));
            }

            GameState gameState = new GameState(players, briscola)
            {
                Turn = turn
            };

            foreach (var player in players)
            {
                if (player.Strategy == sut)
                {
                    foreach (var card in handCards)
                    {
                        player.Take(card);
                    }
                }
                else
                {
                    player.Take(deck.Pop());
                    player.Take(deck.Pop());
                    player.Take(deck.Pop());
                }
            }

            foreach (var card in dish)
            {
                gameState.Dish.Add(card);
            }

            return(gameState);
        }