Pole FindPoleWithBiggestDisc(int reducer)
        {
            int  biggestNumber = m_numberOfDiscs - reducer;
            Pole poleFound     = null;

            foreach (Pole pole in m_polesInUse)
            {
                if (pole.IsEmpty())
                {
                    continue;
                }

                Disc discOnPole = pole.PeekDisc();

                if (discOnPole == null)
                {
                    continue;
                }

                if (discOnPole.GetDiscSize() == biggestNumber)
                {
                    biggestNumber = discOnPole.GetDiscSize();
                    poleFound     = pole;
                    break;
                }
            }

            return(poleFound);
        }
        Pole FindPoleWithSmallestDisc()
        {
            Pole poleFound          = null;
            int  smallestDiscNumber = m_numberOfDiscs;

            foreach (Pole pole in m_polesInUse)
            {
                if (pole.IsEmpty())
                {
                    continue;
                }
                else
                {
                    Disc discOnPole = pole.PeekDisc();

                    if (discOnPole == null)
                    {
                        continue;
                    }

                    if (discOnPole.GetDiscSize() <= smallestDiscNumber)
                    {
                        smallestDiscNumber = discOnPole.GetDiscSize();
                        poleFound          = pole;
                    }
                }
            }

            return(poleFound);
        }
Пример #3
0
 public bool CompareDiscs(Disc checkingDisc)
 {
     return((m_discSize > checkingDisc.GetDiscSize()) || this == null);
 }