Example #1
0
        public void FullRevert()
        {
            LineTemplate index = new LineTemplate();

            index.AddTemplate("ore/cuprum");
            index.AddTemplate("ore/cuprum/ore/cuprum/oil");
            index.AddTemplate("ore/cuprum/ore/tail");
            index.Next("ore");
            index.Next("cuprum");
            index.Next("ore");
            index.Next("cuprum");
            index.Next("ore");
            index.Preverios();
            index.Preverios();
            index.Preverios();
            index.Preverios();
            index.Preverios();
            index.Next("ore");
            index.Next("cuprum");
            index.Next("ore");
            index.Next("cuprum");
            index.Next("oil");
            index.Next("ore");
            index.Next("cuprum");
            index.Next("ore");
            index.Next("cuprum");
            index.Next("oil");
            Assert.AreEqual <int>(2, index.Cicles);
        }
Example #2
0
        private void PField_MouseMove(object sender, MouseEventArgs e)
        {
            if (LefButton)
            {
                int x = ((e.Location.X - e.Location.X % SIZE_BUTTON) / SIZE_BUTTON);
                int y = ((e.Location.Y - e.Location.Y % SIZE_BUTTON) / SIZE_BUTTON);


                if (x >= 0 && x < field.Count && y >= 0 && y < field.Count)
                {
                    if (Tail.Last() != field[x][y])
                    {
                        if (Tail.Count > 1 && field[x][y] == Tail[Tail.Count - 2])
                        {
                            Tail.Last().BackColor = Color.Gray;
                            Tail.Remove(Tail.Last());
                            assebler.Preverios();
                        }
                        else
                        {
                            field[x][y].BackColor = Color.Red;
                            Tail.Add(field[x][y]);
                            switch ((int)field[x][y].Tag)
                            {
                            case 0: assebler.Next("ore"); break;

                            case 1: assebler.Next("cupper");; break;

                            case 2: assebler.Next("oil"); break;
                            }
                        }
                    }
                    PrintTail();
                }
            }
        }