Ejemplo n.º 1
0
        public void MakeCalculations()
        {
            var handCalculator = new HandCalculator(_completeHand);

            handCalculator.MakeCalculations();
            Shanten = handCalculator.GetShanten;

            foreach (var tile in _completeHand)
            {
                DiscardOptimizer discardOptimizer = new DiscardOptimizer(_completeHand, tile, Shanten);
                discardOptimizer.DetermineFitness();
                if (discardOptimizer.IsFit)
                {
                    DiscardsInfo.Add(discardOptimizer);
                }
            }

            DiscardsInfo = DiscardsInfo.OrderByDescending(discardInfo => discardInfo.TotalUkeireTiles).ToList();

            for (int i = DiscardsInfo.Count - 1; i >= 0; i--)
            {
                if (DiscardsInfo[i].TotalUkeireTiles == 0)
                {
                    DiscardsInfo.RemoveAt(i);
                }
            }
        }
        public void DetermineFitness()
        {
            _completeHand.Remove(DiscardedTile);
            HandCalculator handCalculator = new HandCalculator(_completeHand);

            handCalculator.MakeCalculations();
            Ukeire      = handCalculator.GetUkeire;
            _newShanten = handCalculator.GetShanten;
            if (_newShanten == _originalShanten)
            {
                IsFit = true;
                DetermineTotalUkeireTiles();
            }
        }