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); }
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) { } }
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); } }
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); }
public virtual void Pick(List <Domino> playersDominos, DominoList sourceList) { playersDominos.Add(sourceList.TakeNextAvailable()); }
internal void SetPickList(DominoList list) { _list = list; _train = new Train(true, list.FirstDouble, this); }