public void SetUp() { _scoreCalculator = new ScoreCalculator(); _gameState = new GameState { GameRules = new GameRules(GameScoreType.Standard121, 2), PlayerIds =new List<int>{1,2}, OpeningRound = new OpeningRound(), IndividualScores = new List<PlayerScore> { new PlayerScore {Player = 1, Score = 0}, new PlayerScore {Player = 2, Score = 0} }, Rounds = new List<RoundState> { new RoundState { PlayerCrib = 1, Hands = new List<PlayerIdHand> { new PlayerIdHand(1,new List<Card> { new Card(Rank.Six, Suit.Clubs), new Card(Rank.Seven,Suit.Diamonds), new Card(Rank.Seven,Suit.Hearts), new Card(Rank.Eight, Suit.Spades) } ), new PlayerIdHand( 2,new List<Card> { new Card(Rank.Four, Suit.Spades), new Card(Rank.Jack, Suit.Hearts), new Card(Rank.Six, Suit.Diamonds), new Card(Rank.Five, Suit.Clubs) } ) }, ThePlay = new List<List<PlayerPlayItem>> { new List<PlayerPlayItem>() }, ThrowCardsComplete = true, PlayedCardsComplete = true, Starter = new Card(Rank.Eight, Suit.Clubs), ShowScores = new List<PlayerScoreShow> { new PlayerScoreShow{ ShowScore = 0, HasShowed = false, Player = 1, PlayerCountedShowScore = 0, CribScore = null }, new PlayerScoreShow{ ShowScore = 0, HasShowed = false, Player = 2, PlayerCountedShowScore = 0, CribScore = null } }, Round = 1 } }, TeamScores = new List<TeamScore> { new TeamScore { Players = new List<int> { 1 } }, new TeamScore { Players = new List<int> { 2 } } } }; }
public void MinAverageDecision_Throws_Most_Valuable_Card() { var hand = new List<Card> { new Card(Rank.Five, Suit.Clubs), new Card(Rank.Queen, Suit.Clubs), new Card(Rank.Jack, Suit.Clubs), new Card(Rank.King, Suit.Clubs), new Card(Rank.Nine, Suit.Hearts), }; var calculator = new ScoreCalculator(); var decisionStrategy = new MinAverageDecision(calculator); var cardsToThrow = decisionStrategy.DetermineCardsToThrow(hand).ToList(); cardsToThrow.Should().HaveCount(1); cardsToThrow.Should().Contain(new Card(Rank.Five, Suit.Clubs)); }
public Player CreatePlayer(AiDifficulty difficulty, string name) { var standardOrder = new StandardOrder(); var scoreCalculator = new ScoreCalculator(); switch (difficulty) { case AiDifficulty.Easy: return new Player(name, -1, new LowestCardPlayStrategy(standardOrder), new MinAverageDecision(scoreCalculator), new PercentageScoreCountStrategy(70, scoreCalculator)); case AiDifficulty.Medium: return new Player(name, -1, new LowestCardPlayStrategy(standardOrder), new RandomDecision(), new PercentageScoreCountStrategy(80, scoreCalculator)); case AiDifficulty.Hard: return new Player(name, -1, new LowestCardPlayStrategy(standardOrder), new OptimisticDecision(), new PercentageScoreCountStrategy(90, scoreCalculator)); case AiDifficulty.Expert: return new Player(name, -1, new LowestCardPlayStrategy(standardOrder), new MaxAverageDecision(scoreCalculator), new PercentageScoreCountStrategy(100, scoreCalculator)); default: throw new NotSupportedException("Difficulty type not supported."); } }
protected AbstractAverageDecision(ScoreCalculator scoreCalculator = null) { _scoreCalculator = scoreCalculator ?? new ScoreCalculator(); }
public MinPlayStrategy(ScoreCalculator scoreCalculator = null, ICardValueStrategy valueStrategy = null) { _scoreCalculator = scoreCalculator ?? new ScoreCalculator(); _valueStrategy = valueStrategy ?? new AceLowFaceTenCardValueStrategy(); }
public OptimisticDecision(ScoreCalculator scoreCalculator = null) { _scoreCalculator = scoreCalculator ?? new ScoreCalculator(); _deck = new Deck(); }
public GameStateBuilder() { _scoreCalculator = new ScoreCalculator(); }
public MinAverageDecision(ScoreCalculator scoreCalculator = null) : base(scoreCalculator) { }
public PercentageScoreCountStrategy(int percentageCorrect = 100, ScoreCalculator scoreCalculator = null) { _percentageCorrect = percentageCorrect; _scoreCalculator = scoreCalculator ?? new ScoreCalculator(); }
public void Setup() { _scoreCalculator = new ScoreCalculator(); }