Exemplo n.º 1
0
 private void GenerateNeededParts(bool Set)
 {
     Sprung1 = m_rp.GetSprung(false);
     Sprung1.Rotate270();
     Sprung2 = m_rp.GetSprung(false);
     Sprung2.MirrorX();
     Sprung2.Rotate90();
     Straight1 = m_rp.GetStraight(0);
     Straight2 = m_rp.GetStraight(1);
     Cross     = m_rp.GetCrossing();
     FlipFlop  = m_rp.GetFlipFlop(!Set);
     Lazy      = m_rp.GetLazy(!Set);
     Lazy.Rotate270();
     Curve1 = m_rp.GetCurve(0);
     Curve2 = m_rp.GetCurve(1);
     Curve3 = m_rp.GetCurve(2);
 }
Exemplo n.º 2
0
        private void SetConn()
        {
            RailParts rp      = new RailParts();
            int       OutYPos = m_core.YRailsCnt + m_States;
            int       OutXPos = m_core.BeginRailsOuts + m_States * 2;
            MyPGM     Sprung1 = rp.GetSprung(false);

            Sprung1.Rotate90();
            Sprung1.MirrorY();
            MyPGM Sprung2 = rp.GetSprung(false);

            Sprung2.Rotate270();
            Sprung2.MirrorY();
            MyPGM Sprung3 = rp.GetSprung(true);

            Sprung3.Rotate270();
            Sprung3.MirrorY();
            for (int i = 0; i < m_States; i++)
            {
                for (int j = 0; j < m_States; j++)
                {
                    if (j == i)
                    {
                        SetField(Sprung1, m_States * 2 - j - 1, ReadWriteHead.YRailsCnt * i + ReadWriteHead.XReadInput + m_States + 1);
                        SetField(Sprung2, j, ReadWriteHead.YRailsCnt * i + ReadWriteHead.XReadInput + m_States + 1);
                        SetField(rp.GetCurve(1), m_States * 4 + ReadWriteHead.XRailsCnt + i + 1, ReadWriteHead.YRailsCnt * i + ReadWriteHead.XReadInput + m_States + 1);
                        SetField(Sprung3, m_States * 5 + ReadWriteHead.XRailsCnt + m_States - i, ReadWriteHead.YRailsCnt * i + ReadWriteHead.XReadInput + m_States + 1);
                    }
                    else if (j < i)
                    {
                        SetField(rp.GetCrossing(), m_States * 2 - j - 1, ReadWriteHead.YRailsCnt * i + ReadWriteHead.XReadInput + m_States + 1);
                        SetField(rp.GetStraight(1), j, ReadWriteHead.YRailsCnt * i + ReadWriteHead.XReadInput + m_States + 1);
                        SetField(rp.GetStraight(1), m_States * 4 + ReadWriteHead.XRailsCnt + i + 1, ReadWriteHead.YRailsCnt * j + ReadWriteHead.XReadInput + m_States + 1);
                        SetField(rp.GetStraight(1), m_States * 5 + ReadWriteHead.XRailsCnt + m_States - j, ReadWriteHead.YRailsCnt * i + ReadWriteHead.XReadInput + m_States + 1);
                    }
                    else
                    {
                        SetField(rp.GetStraight(1), m_States * 2 - j - 1, ReadWriteHead.YRailsCnt * i + ReadWriteHead.XReadInput + m_States + 1);
                        SetField(rp.GetCrossing(), j, ReadWriteHead.YRailsCnt * i + ReadWriteHead.XReadInput + m_States + 1);
                        SetField(rp.GetStraight(0), m_States * 4 + ReadWriteHead.XRailsCnt + i + 1, ReadWriteHead.YRailsCnt * j + ReadWriteHead.XReadInput + m_States + 1);
                        SetField(rp.GetCrossing(), m_States * 5 + ReadWriteHead.XRailsCnt + m_States - j, ReadWriteHead.YRailsCnt * i + ReadWriteHead.XReadInput + m_States + 1);
                    }
                }
                for (int j = i; j < m_States - 1; j++)
                {
                    for (int z = 1; z < ReadWriteHead.YRailsCnt; z++)
                    {
                        SetField(rp.GetStraight(0), m_States * 2 - i - 1, ReadWriteHead.YRailsCnt * j + ReadWriteHead.XReadInput + m_States + 1 + z);
                        SetField(rp.GetStraight(0), m_States * 4 + ReadWriteHead.XRailsCnt + i + 1, ReadWriteHead.YRailsCnt * j + ReadWriteHead.XReadInput + m_States + 1 + z);
                    }
                }
                for (int j = 0; j < i; j++)
                {
                    for (int z = 1; z < ReadWriteHead.YRailsCnt; z++)
                    {
                        SetField(rp.GetStraight(0), i, ReadWriteHead.YRailsCnt * j + ReadWriteHead.XReadInput + m_States + 1 + z);
                        SetField(rp.GetStraight(0), m_States * 5 + ReadWriteHead.XRailsCnt + (m_States - i - 1) + 1, ReadWriteHead.YRailsCnt * j + ReadWriteHead.XReadInput + m_States + 1 + z);
                    }
                }
                for (int j = 0; j < (ReadWriteHead.YRailsCnt - ReadWriteHead.XReadInput); j++)
                {
                    SetField(rp.GetStraight(0), m_States + i, ReadWriteHead.YRailsCnt * m_States + m_States + j);
                    SetField(rp.GetStraight(0), m_States * 4 + ReadWriteHead.XRailsCnt + 1 + i, ReadWriteHead.YRailsCnt * m_States + m_States + j);
                }
                for (int j = m_States * 2; j < OutXPos; j++)
                {
                    SetField(rp.GetStraight(1), j, OutYPos + i);
                }
                for (int j = m_States; j < m_States * 3 + m_core.XRailsCnt; j++)
                {
                    SetField(rp.GetStraight(1), j, i);
                }
                for (int j = 0; j < ReadWriteHead.XReadInput + 1; j++)
                {
                    SetField(rp.GetStraight(0), i, j + m_States);
                    SetField(rp.GetStraight(0), m_States * 3 + m_core.XRailsCnt + i, j + m_States);
                }
            }
            SetRound(m_States, OutXPos, OutYPos, 2);
            SetRound(m_States, m_States, OutYPos, 3);
            SetRound(m_States, OutXPos + m_States, OutYPos, 3);
            SetRound(m_States, OutXPos + m_States + m_States, OutYPos, 2);
            SetRound(m_States, 0, 0, 0);
            SetRound(m_States, m_States * 3 + m_core.XRailsCnt, 0, 1);
        }