Beispiel #1
0
        private Train _train = null; // Players private train.

        public Player(String name, DominoList list, IStrategy strategy)
        {
            Name      = name;
            _list     = list;
            _strategy = strategy;
            _train    = new Train(true, list.FirstDouble, this);
        }
Beispiel #2
0
        public void TestEricsStrategy()
        {
            DominoList dominos = new DominoList();

            Player playerOne = new Player("Brian", dominos, new TopDownPublicAnyStrategy());

            playerOne.Take(12);

            Player playerTwo = new Player("Eric", dominos, new EricsStrategy());

            playerTwo.Take(12);

            GameManager.Init(dominos, playerOne, playerTwo);

            playerOne.Play();
            playerTwo.Play();

            try
            {
                while (!playerTwo.Won)
                {
                    playerTwo.Play();
                }
            }
            catch (Exception e)
            {
            }
        }
Beispiel #3
0
        public override void Pick(List <Domino> playersDominos, DominoList sourceList)
        {
            Domino domino = sourceList.TakeNextAvailable();

            if (_privateTrain != null && _privateTrain.CanPlayDomino(domino))
            {
                domino.MarkForPrivatePlay = true;
                _privateTrain.PlayDomino(domino);
            }
            else
            {
                playersDominos.Add(domino);
            }
        }
Beispiel #4
0
        public void TestPlayerHasInitialTrain()
        {
            DominoList dominos = new DominoList();

            Player playerOne = new Player("Player One", dominos, new TopDownPrivateExclusiveStrategy());

            playerOne.Take(12);

            GameManager.Init(dominos, playerOne);

            // Players first domino is the first double picked from the list.
            Assert.IsTrue(!playerOne.Train.IsEmpty);

            playerOne.Play();

            // This player does not play on the public train
            Assert.IsTrue(GameManager.Instance.PublicTrain.IsEmpty);
        }
Beispiel #5
0
 public virtual void Pick(List <Domino> playersDominos, DominoList sourceList)
 {
     playersDominos.Add(sourceList.TakeNextAvailable());
 }
Beispiel #6
0
 internal void SetPickList(DominoList list)
 {
     _list  = list;
     _train = new Train(true, list.FirstDouble, this);
 }