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()); }
public IEnumerable <IHand> GetCurrentHands() { return(handDatabase.SearchHands(player.GetPieceList())); }
public (IPlayer scorer, int score) Calculate(IPlayer player) { var score = handDatabase.SearchHands(player.GetPieceList()).Sum(hand => hand.Score); return(player, score); }