Beispiel #1
0
        bool CheckHandIncrease(IReadOnlyPlayer currentPlayer)
        {
            if (!previousHandsDictionary.ContainsKey(currentPlayer))
            {
                previousHandsDictionary.Add(currentPlayer, Array.Empty <IHand>());
            }

            IEnumerable <IHand> currentHands   = handDatabase.SearchHands(currentPlayer.GetPieceList());
            HandDifference      handDifference = HandDifferenceCalculator.Calculate(previousHandsDictionary[currentPlayer], currentHands);

            if (handDifference.IncreasedDifference.Any() || handDifference.IncreasedDifference.Any())
            {
                previousHandsDictionary[currentPlayer] = currentHands.ToArray();
            }

            return(handDifference.IncreasedDifference.Any());
        }
Beispiel #2
0
 public IEnumerable <IHand> GetCurrentHands()
 {
     return(handDatabase.SearchHands(player.GetPieceList()));
 }
Beispiel #3
0
        public (IPlayer scorer, int score) Calculate(IPlayer player)
        {
            var score = handDatabase.SearchHands(player.GetPieceList()).Sum(hand => hand.Score);

            return(player, score);
        }